Exception and Error Handling
Opened this issue · 0 comments
madhavipuliraju commented
Please find the best practices for handling and creating exceptions.
- Use try/catch/finally blocks to recover from errors or release resources
- Handle common conditions without throwing exceptions
- Design classes so that exceptions can be avoided
- Throw exceptions instead of returning an error code
- Use the predefined exception types
- Use grammatically correct error messages
- In custom exceptions, provide additional properties as needed
- Restore state when methods don't complete due to exceptions