-
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
Sylvanie85/issue61 #82
Conversation
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.
Can we move the Error class definitions into a separate module so that we are not redefining them in multiple files?
There is a custom_exceptions.py file
The issue this PR is based upon #61 which basically has the goal to remove the custom_exceptions file and redistribute the error to be module based instead |
That's okay for exceptions unique to a module, but some exceptions are shared. For example we do not redefine KeyError because that is something that is common. For example the proposed approach has ApiErrors defined in multiple files. That seems wrong |
I can elaborate on the issue as follows Module 1 defines ApiError Now if ApiError in Module 1 and 2 are in fact different but kinda related then they should inherit from a common parent ApiError but then they should have their own name |
Reviewing the changes I agree. The custom_exception file had too many exceptions in it, which are now module based. However defining APIErrors in 6+ files seems wrong. |
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.
Based on the discussion with @ChromaticPanic we should have a module to inherit the reccuring error Ex: class ProcessInferenceResultsError(APIErrors) :
So i need to create a new file to inherit the exception as was custom_exeptions ? |
Yeah I would make that common ApiError But also in each file I would use unique names for example in swin.py instead of ProcessInferenceResultsError(ApiError) I would name it SwinError(ApiError) or SwinApiError (I don't know at this point how many error types will be thrown by each module) |
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.
I like the new exception file and custom naming per module. I willl look into adapting the datastore to this standard!
LGTM! 👍🏻
I did some refactoring as my first issue on nachet-backend.
The issue #61 was deprecated because the code has changed a lot since it was created. But I did make some fixes to the exception handling.