openmobilehub / android-omh-storage

https://www.openmobilehub.org
Apache License 2.0
4 stars 1 forks source link

[OMHD-466] sample app is crashing when one drive owner gives permissions to himself #49

Closed damiann5f closed 4 months ago

damiann5f commented 4 months ago

Summary

This PR includes refactor of exceptions handling coming from the providers. Issues fixed:

  1. Some methods, like delete, were swallowing exceptions from the providers, which made it impossible to distinguish the cause of the failed operation.

  2. 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.

Demo

https://github.com/user-attachments/assets/74556d2e-412d-4df3-bfdb-59e3f2eabc71

Checklist:

Closes: OMHD-466