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

models: JSON-friendly errors in ensure_state #172

Merged
merged 1 commit into from
Dec 8, 2017
Merged

models: JSON-friendly errors in ensure_state #172

merged 1 commit into from
Dec 8, 2017

Conversation

jacquerie
Copy link
Contributor

Closes #171, but I'm not fully convinced that this is the best solution for the problem as all those small classes looks a bit clunky. It's also missing tests as they seem tricky to write, and if this solution is not going in the right direction then it would have been a waste of effort...

Signed-off-by: Jacopo Notarstefano <jacopo.notarstefano@gmail.com>
@jacquerie
Copy link
Contributor Author

It's also missing tests as they seem tricky to write

Turns out they weren't that hard, so I added a PoC for them.

@@ -141,6 +141,32 @@ def inner(self, *args, **kwargs):
return decorator


class BucketError(object):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should they not inherit from Exception?

Copy link
Contributor Author

@jacquerie jacquerie Dec 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two classes are patterned over https://github.com/inveniosoftware/invenio-rest/blob/d5a3d185c0a8c8cd46860bd0fd9be8bb3786f157/invenio_rest/errors.py#L35-L58, which also doesn't inherit from Exception, possibly because it's not intended to be thrown, but is just representing an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...that said, I can absolutely change them if you think it's better!

Copy link
Member

@lnielsen lnielsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Looks fine to me. Just the small comment on the base class.

@lnielsen lnielsen self-assigned this Dec 7, 2017
@lnielsen lnielsen merged commit 2b21b80 into inveniosoftware:master Dec 8, 2017
@jacquerie jacquerie deleted the fix-issue-171 branch December 8, 2017 08:36
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.

None yet

2 participants