Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

An in-band error indicator is a type returned by a function that can indicate either a legitimate return value , or an illegitimate value that indicates an error of some sort. Some common examples of in-band error indicators include:

In-band - error indicators require checking for the error; however, this checking is often overlooked. Failure to check for such error conditions not only violates EXP00-J. Do not ignore values returned by methods, but also has the unfortunate effect of propagating invalid values that may subsequently be treated as valid in later computations.

...

Returning an object that might be null on failure or a valid object on success is a common example of in-band error indicator. While there are often Although better function designs are often available, returning an object that may be null can be acceptable under some circumstances. See 26. MET54-JG. Always provide feedback about the resulting value of a method for an example.

...