Skip to content
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

Created the exceptions handler module for the knitlib #56

Merged
merged 8 commits into from
Aug 13, 2015

Conversation

shiluka
Copy link
Member

@shiluka shiluka commented Aug 6, 2015

Issue #53

shiluka added a commit that referenced this pull request Aug 13, 2015
Created the exceptions handler module for the knitlib
@shiluka shiluka merged commit 3d2640d into fossasia:staging Aug 13, 2015
@tian2992
Copy link
Contributor

It is not a good idea to have the Exceptions' Base Class named Error. It is too similar to the Language's exceptions https://docs.python.org/2/library/exceptions.html

Also you can put the constructor in the parent class constructor instead of repeating code on each subclass.

@shiluka
Copy link
Member Author

shiluka commented Aug 14, 2015

Having a separate exception module for the knitlib, I created exceptions which is specific to the knitlib. So it is better to subclass that exception, instead of the generic Exception. ( When creating a module that can raise errors, a common practice is to create a base class for exceptions defined by that module, and subclass that to create specific exception classes for different error conditions )

@shiluka shiluka deleted the exception_handler branch August 14, 2015 03:45
@shiluka
Copy link
Member Author

shiluka commented Aug 14, 2015

Otherwise in order to catch it, either have to name it specifically (importing it if created elsewhere) or catch Exception, (but probably not prepared to handle all types of Exceptions also new developer can extend the module easily). Also many standard libraries define their own exceptions to report errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants