Comment 1 for bug 972329

Revision history for this message
James Westby (james-w) wrote : Re: [Bug 972329] [NEW] No way for backends to raise a user-friendly error

On Tue, 03 Apr 2012 11:12:26 -0000, Jonathan Lange <email address hidden> wrote:
> If the binary backend wants to signal a failure to the user in a
> friendly fashion, then it currently has no recourse for doing so.

Options:

  1. Don't use subprocesses, allowing the backend to raise errors
     directly.
     + Obvious how the errors reach the user
     + Maybe requires extra complexity in running the backend code to
       handle buggy backends.
     - Only suitable for python backends.

  2. Add a protocol for the backend to signal (exception type, value) to
     be raised by the main process.
     + Allows for specific exceptions to be raised
     - Requires a more complex backend interface
     - Adding new exception types requires co-ordination

  3. Improve the presentation of the current exceptions
     + Keeps a thin interface with the backends

I think I prefer the third option.

If the traceback was supressed for ScriptFailed, and the binary backend
supressed the traceback for Unknown Dependency, then you could have
terser output.

If we also added a special return code that signified "this isn't a
crash, this is a problem the user needs to fix" then the output could be
reduced to:

  BackendError: Unknown dependency: "libtinfo.so.5"

(or even further if the fact that it is a BackendError is dropped.)

Thanks,

James