Effective Code Review for Software Engineering: A practice guide for step by step code review by WhiteTeaNerd WhiteTeaNerd

Effective Code Review for Software Engineering: A practice guide for step by step code review by WhiteTeaNerd WhiteTeaNerd

Author:WhiteTeaNerd WhiteTeaNerd [WhiteTeaNerd, WhiteTeaNerd]
Language: eng
Format: epub
Published: 2017-03-25T07:00:00+00:00


Chapter 5: Error handling

Error handling is an avoidable part of the code. Here are the two important things to check on to ensure proper error handling:

1. Do not use error codes. Use exceptions

The exceptions provided by the programming language is usually sufficient to handle errors. Adding error codes adds little value and it clusters the code.

2. Throw exception where the error occurs. Do not ask upstream code to handle it

For example, if some variable’s value should not be null, throw the exception in the code where the null occurs instead of doing null check upstream.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.