teragrep / zep_01

0 stars 0 forks source link

Refactor Exception handling to use rethrowing #30

Open Laukkala opened 1 month ago

Laukkala commented 1 month ago

Remove instances of execution forking via Exceptions and replace them with rethrowing the exception Use minimal number of catch-clauses at the highest possible level of the program Add a descriptive message in natural language when re-throwing to tell users what went wrong

Stack traces should not be shown to the end user, only the descriptive message part of an Exception Stack traces should be printed to logs instead, where an administrator can take a closer look.

To do: implement unit tests

Websocket operations that are currently rethrowing exceptions: LIST_NOTES RELOAD_NOTES_FROM_REPO GET_HOME_NOTE GET_NOTE RELOAD_NOTE NEW_NOTE DEL_NOTE REMOVE_FOLDER CLONE_NOTE MOVE_NOTE_TO_TRASH MOVE_FOLDER_TO_TRASH EMPTY_TRASH RESTORE_NOTE RESTORE_ALL RESTORE_FOLDER MOVE_PARAGRAPH INSERT_PARAGRAPH COPY_PARAGRAPH PARAGRAPH_REMOVE

Laukkala commented 1 month ago

Zeppelin's Exception handling has caused problems with error information being hidden from users and developers Optimally, Exceptions should be only caught once at the highest level of the application, and chained together so they can be used to construct a clear message detailing what went wrong for the user and a detailed stack trace for developers to ease debugging