-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactor Flask III] Remove api.abort and other error handlers #798
Conversation
for more information, see https://pre-commit.ci
…rodatawithoutborders/nwb-guide into swap_try_except_to_decorator
This seems fine. The request now directly throws an error on the GUIDE in a way that keeps the Error type appended to the front of the message—though I don't mind that too much. Can always parse it out if desired |
And this decision seems a bit simpler, where we remove any parsing from the backend and move it to the frontend |
for more information, see https://pre-commit.ci
From @garrettmflynn in #796 (comment)
And how does nwb-guide/src/electron/renderer/src/stories/pages/settings/SettingsPage.js Lines 183 to 186 in 80a9082
All I know right now is that a good looking error is notified to the front end |
The |
So does that make the frontend simpler? We can still |
Yes, since the error handling is uniform now, I believe we can rely on the native error thrown across all requests. |
OK I removed all the places I could spot Be sure to play around with this in the app to ensure it behaves as we both expect |
Ah figured it out. These are not actually handled differently by the backend. Instead, the frontend calls are different. For the metadata request, I'm using a raw Sitting down for the week, I remember that I've had a bit of a gripe with the way So it seems like we will need to keep the frontend aspects of this parsing. And it might be a good idea to include a top-level exception handler to ensure we receive errors that can be formatted in an informative way. Thoughts? |
You got it. I've already pushed it in a comment for comparison. |
@garrettmflynn Does my latest push satisfy the issues? Restructured the message to match Python more closely |
My bad, f-string for the message was botched Can you try again? Frontend is just displaying the |
…rodataWithoutBorders/nwb-guide into swap_try_except_to_decorator
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…rodataWithoutBorders/nwb-guide into swap_try_except_to_decorator
for more information, see https://pre-commit.ci
…rodataWithoutBorders/nwb-guide into swap_try_except_to_decorator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Thanks for pushing on this!
Assessing how much of the previous logic around
api.abort
orapi.errorhandler
is actually necessary with the new logger structure attached to the appThe following are two example logs that also printed messages to the dev console
The were both triggered by the temporary/fake
NotImplementedError
places in the dataset generation endpoint and triggered via the 'generate' button on the settings pageThe first, (31) did not have the
api.abort
2024-05-25_17-14-31.log
It also corresponds to this screenshot of the displayed error on the GUIDE
The second (32) used the possibly temporary decorator which has basically the same effect as the old try/except
2024-05-25_17-13-32.log
Its screenshot of the displayed error was
Furthermore, removing the
api.errorhandler
changed nothing in either case for either the displayed message, dev console, or logConclusion: I'd say we no longer need any
api.abort
or other error handling now that we have the core logger@garrettmflynn WDYT?