ert
ert copied to clipboard
Refine exception strategy
Context
In https://github.com/equinor/ert/pull/1314 an ert.exceptions
module was introduced. The mission was to set ourselves up for clearly distinguishing between user error and bugs / internal errors. All exceptions in the module inherit from the exception ERTError
and then the CLI currently catches all ERTErrors
and nicely formats the message of the exception before exiting.
Status
As of now multiple new exceptions has been introduced in the module, some of which are raised further down into the call stack then in the original implementation. A natural question is: will ert.storage
ever be able to detect user errors. As in, should storage be provided with enough context to deduce that?
Suggestion
I suggest we shut down the exceptions
module by moving the different exceptions into the sub-modules they belong to. I also think we should aim for the catching in the client to only encompass exceptions from engine and client. If someone further down in the call stack detects an error, they should raise and then the engine (or client) should based on their additional context decide whether this is a user error that should be nicely formatted or a bug that deserves a full stack trace.