HoloClean / holoclean

A Machine Learning System for Data Enrichment.
http://www.holoclean.io
Apache License 2.0
514 stars 129 forks source link

Re-factor use of exception handlers #20

Closed richardwu closed 5 years ago

richardwu commented 5 years ago

There are two unfortunate use-patterns of exception handlers in the codebase atm:

1. silencing exceptions with status messages

Example and fix.

We catch an exception then only return the error message in the status variable. This is bad since it silences programming errors like OutOfRangeErrors that should be propagated. Note the fix consists of two components:

  1. Using logging.error to add additional context information
  2. Re-raise (not raise another exception) via raise with no arguments. This keeps the stack trace intact for debugging/logs.

2. catching exceptions and raising a wrapped exception

Example and fix.

Similar to 1. above, we should be using logging.error and raise with no arguments to add context and re-raise the exception.