Skip to content

Latest commit

 

History

History
46 lines (21 loc) · 655 Bytes

error-handling.md

File metadata and controls

46 lines (21 loc) · 655 Bytes

Error Handling.

Contents at a Glance.

About.

Documentation.

  • Use exceptions, not return codes.
  • try-catch-finally block.
  • Not catch Errors.
  • Not catch Throwable.
  • Catch all exceptions.
  • Never use checked exceptions.
  • Context in exceptions
  • Context in exceptions message.
  • Custom exception always should have a constructor that takes another exception. Example -> UILayoutException(DomainLayoutException(DaoLayoutException(RecordNotFound())))
  • Don't return null. Think about 'null object pattern'.
  • Don't pass null to methods

Help.