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

User friendly message when sending garbage as Avro #728

Closed
adamdubiel opened this issue Feb 17, 2017 · 1 comment
Closed

User friendly message when sending garbage as Avro #728

adamdubiel opened this issue Feb 17, 2017 · 1 comment
Milestone

Comments

@adamdubiel
Copy link
Collaborator

Currently when user sends JSON on Avro topic without Content-Type: application/json, Frontend returns 400 Bad Content, which is ok, but also internally throws:

pl.allegro.tech.hermes.frontend.validator.InvalidMessageException: Could not deserialize avro message with provided schema Errors: ArrayIndexOutOfBoundsException: 
	at pl.allegro.tech.hermes.frontend.validator.AvroTopicMessageValidator.check(AvroTopicMessageValidator.java:26)
	at pl.allegro.tech.hermes.frontend.validator.MessageValidators.lambda$check$0(MessageValidators.java:19)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at pl.allegro.tech.hermes.frontend.validator.MessageValidators.check(MessageValidators.java:19)
	at pl.allegro.tech.hermes.frontend.publishing.message.MessageFactory.createAvroMessage(MessageFactory.java:108)
	at pl.allegro.tech.hermes.frontend.publishing.message.MessageFactory.create(MessageFactory.java:86)
	at pl.allegro.tech.hermes.frontend.publishing.message.MessageFactory.create(MessageFactory.java:60)
	at pl.allegro.tech.hermes.frontend.publishing.handlers.MessageCreateHandler.handleRequest(MessageCreateHandler.java:35)
	at pl.allegro.tech.hermes.frontend.publishing.handlers.PreviewHandler.handleRequest(PreviewHandler.java:22)
	at pl.allegro.tech.hermes.frontend.publishing.handlers.MessageReadHandler.messageRead(MessageReadHandler.java:138)
	at pl.allegro.tech.hermes.frontend.publishing.handlers.MessageReadHandler.lambda$partialMessageRead$2(MessageReadHandler.java:105)
	at io.undertow.io.AsyncReceiverImpl.receivePartialBytes(AsyncReceiverImpl.java:582)
	at pl.allegro.tech.hermes.frontend.publishing.handlers.MessageReadHandler.readMessage(MessageReadHandler.java:80)
	at pl.allegro.tech.hermes.frontend.publishing.handlers.MessageReadHandler.handleRequest(MessageReadHandler.java:54)
	at pl.allegro.tech.hermes.frontend.publishing.handlers.TopicHandler.lambda$handleRequest$0(TopicHandler.java:47)
	at pl.allegro.tech.hermes.frontend.publishing.handlers.TopicHandler.onTopicPresent(TopicHandler.java:61)
	at pl.allegro.tech.hermes.frontend.publishing.handlers.TopicHandler.handleRequest(TopicHandler.java:43)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:207)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:810)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Which tells nothing about real cause of problems. Users think this has something to do with wrong Avro schema. Frontend should be more explicit in this case and just say, that user is sending something that is not Avro.

@twisniewski
Copy link

👍

@adamdubiel adamdubiel added this to the 0.11.1 milestone Feb 17, 2017
@adamdubiel adamdubiel modified the milestones: 0.11.1, 0.11.2 Mar 7, 2017
adamdubiel pushed a commit that referenced this issue Mar 14, 2017
message payload content-type check & error message for wrong content-type (#728)
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

2 participants