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

from_http better exception handling #104

Closed
cumason123 opened this issue Aug 13, 2020 · 1 comment
Closed

from_http better exception handling #104

cumason123 opened this issue Aug 13, 2020 · 1 comment

Comments

@cumason123
Copy link
Contributor

cumason123 commented Aug 13, 2020

Expected Behavior

from_http(data="", headers={})

This should throw CloudEventMissingFields("Invalid data field") or similar descriptive error

Actual Behavior

First, from_http attempts to read this event as a structured event.

Because there is nothing inside data, it fails to unmarshal'. Therefore it runs json.loads("") because it expects data to be a json string with cloud event extensions.

Finally you get a json decoder error which is difficult to debug

@cumason123
Copy link
Contributor Author

In general, the repository needs better exception handling to help users debug invalid cloudevents easily.

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

No branches or pull requests

1 participant