This PR includes refactor of exceptions handling coming from the providers.
Issues fixed:
Some methods, like delete, were swallowing exceptions from the providers, which made it impossible to distinguish the cause of the failed operation.
Each plugin was throwing its provider exceptions on failed operations. This then requires client of library having to either handle all the types or catch too generic exception (catch: Exception) - the second we were doing in the Sample App with is a code smell.
Now the providers exceptions are wrapped in the OmhStorageException.ApiException with a cause as the original exception. Users of the library can now catch this type and decide if they want to handle it e.g. by status code or by the type of the original cause.
Summary
This PR includes refactor of exceptions handling coming from the providers. Issues fixed:
Some methods, like delete, were swallowing exceptions from the providers, which made it impossible to distinguish the cause of the failed operation.
Each plugin was throwing its provider exceptions on failed operations. This then requires client of library having to either handle all the types or catch too generic exception
(catch: Exception)
- the second we were doing in the Sample App with is a code smell.Now the providers exceptions are wrapped in the
OmhStorageException.ApiException
with acause
as the original exception. Users of the library can now catch this type and decide if they want to handle it e.g. by status code or by the type of the originalcause
.Demo
https://github.com/user-attachments/assets/74556d2e-412d-4df3-bfdb-59e3f2eabc71
Checklist:
Closes: OMHD-466