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

Receive Message Error Handling + 502 Consistency #27

Open
stephenhyde opened this issue Sep 27, 2023 · 0 comments
Open

Receive Message Error Handling + 502 Consistency #27

stephenhyde opened this issue Sep 27, 2023 · 0 comments

Comments

@stephenhyde
Copy link

stephenhyde commented Sep 27, 2023

I know this is probably a product of the API as 502 probably means something flapping at the ingress but regardless the library spits out a weird exception as there is no error handling on status codes (Or there is and it assumes JSON) and it tries to decode an HTML response as JSON.

Version: 0.0.11
Rails: 6.1.7.3
Ruby: 2.7.7

Error Snippet:

[809: unexpected token at '<html> <head><title>502 Bad Gateway</title></head> <body> <center><h1>502 Bad Gateway</h1></center> </body> </html> '](REDACTED?queue=failed#)

Stack Trace

/usr/local/bundle/gems/json-2.5.1/lib/json/common.rb:216:in `parse'
/usr/local/bundle/gems/json-2.5.1/lib/json/common.rb:216:in `parse'
/usr/local/bundle/gems/frontapp-0.0.11/lib/frontapp/client.rb:103:in `create'
/usr/local/bundle/gems/frontapp-0.0.11/lib/frontapp/client/messages.rb:126:in `receive_custom_message

Request:

FrontClient.client.receive_custom_message(channel, {
                                                  sender:
                                                    {
                                                      name: 'REDACTED',
                                                      handle: 'REDACTED'
                                                    },
                                                  subject: 'REDACTED,
                                                  body: 'REDACTED
                                                })

I can go ahead and wrap a standard error around this but I figure I throw it your way for visibility on 502 and the potential for status unwrapping in code.

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