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

Error cathing an exception #12

Closed
tardis4500 opened this issue Feb 25, 2014 · 3 comments
Closed

Error cathing an exception #12

tardis4500 opened this issue Feb 25, 2014 · 3 comments
Assignees
Labels

Comments

@tardis4500
Copy link

If I try to catch an exception as with

try:
redmine.issue.create(**rec)
except redmine.exceptions.ValidationError, err:
print 'My error check'

I get a new exception raised:
redmine.exceptions.ResourceError: Unsupported redmine resource

@maxtepkeev
Copy link
Owner

Yes, because in your context redmine is the instance of Redmine object which knows nothing about exceptions. To make it work you have to do it this way:

from redmine import Redmine
from redmine.exceptions import ValidationError

redmine = Redmine('http://your-redmine-url', ...)

try:
    redmine.issue.create(**rec)
except ValidationError:
   print 'My error check'

@maxtepkeev maxtepkeev self-assigned this Feb 26, 2014
@tardis4500
Copy link
Author

Doh, egg on my face. I was too close to the problem to see that.

Thanks!

@maxtepkeev
Copy link
Owner

No problem!

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

No branches or pull requests

2 participants