Add custom exceptions deriving from std::runtime_error
Change modelReady so it doesn't throw an exception on failure
Closes #30
Motivation
Exceptions in the inference server were a mix of standard C++ exceptions but they were inconsistently used. By using custom exceptions, each exception gets a descriptive name and we can use them more consistently throughout. We can also move towards ensuring that any exceptions thrown into user code will be one of ours so they're easy to catch.
Implementation
New exceptions classes are added in a header file. They follow the naming syntax of existing C++ exceptions. In the Python bindings, the base class
Previously, workerReady, the internal version of modelReady would through an exception if a worker wasn't found. As this is a non-exceptional scenario, this case no longer throws an exception. Instead, it simply returns false. This change allows removing a number of try-catch blocks from the code.
Summary of Changes
std::runtime_error
modelReady
so it doesn't throw an exception on failureCloses #30
Motivation
Exceptions in the inference server were a mix of standard C++ exceptions but they were inconsistently used. By using custom exceptions, each exception gets a descriptive name and we can use them more consistently throughout. We can also move towards ensuring that any exceptions thrown into user code will be one of ours so they're easy to catch.
Implementation
New exceptions classes are added in a header file. They follow the naming syntax of existing C++ exceptions. In the Python bindings, the base class
Previously,
workerReady
, the internal version ofmodelReady
would through an exception if a worker wasn't found. As this is a non-exceptional scenario, this case no longer throws an exception. Instead, it simply returns false. This change allows removing a number of try-catch blocks from the code.