Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleUpdates
  • 2019-02-20: the base Error class has been enhanced to support an error code
  • 2019-01-26: added is_error() and perror_exit(); other updates
  • 2018-01-20: renamed err to erro to avoid possible name conflict
  • 2017-11-08: the section on double assignment was added.

toc-local

Introduction

Errors are typically indicated by a non-zero integer value. Within a program/library, which is the main focus here, error return values are negative. For a program, error exit values are positive. In both cases, a zero value indicates success.

...

Even in Python, exceptions are not always the best way to do things. Sometimes returning an error code or similar is appropriate. In such situations, wherever one lands on the question of using something like Error instead of integer return values for errors, the approach is worth considering. Error is not always appropriate, but it does make one think about the merits of how and why things are done as they are.

Changes

  • 2019-02-20: the base Error class has been enhanced to support an error code
  • 2019-01-26: added is_error() and perror_exit(); other updates
  • 2018-01-20: renamed err to erro to avoid possible name conflict
  • 2017-11-08: the section on double assignment was added.