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

Better InvalidResponse / ErrorResponse messages? #68

Open
bhudgeons opened this issue Jun 22, 2017 · 2 comments
Open

Better InvalidResponse / ErrorResponse messages? #68

bhudgeons opened this issue Jun 22, 2017 · 2 comments

Comments

@bhudgeons
Copy link

In a complicated API, even when handling errors explicitly, there are times when you still get a stacktrace like the one below, which doesn't help you find the error (especially in complicated workflows where the exact call that failed is hard to determine):

featherbed.request.ErrorResponse: Error response received
	at featherbed.request.RequestTypes$RequestSyntax$$anonfun$featherbed$request$RequestTypes$RequestSyntax$$handleRequest$1.apply(RequestSyntax.scala:123)
	at featherbed.request.RequestTypes$RequestSyntax$$anonfun$featherbed$request$RequestTypes$RequestSyntax$$handleRequest$1.apply(RequestSyntax.scala:84)
	at com.twitter.util.Future$$anonfun$flatMap$1.apply(Future.scala:1089)
	at com.twitter.util.Future$$anonfun$flatMap$1.apply(Future.scala:1088)
	at com.twitter.util.Promise$Transformer.liftedTree1$1(Promise.scala:107)
       ...

At least InvalidResponse includes the reason in the message, but ErrorResponse is a complete black box if it gets thrown in a place you didn't explicitly handle it.

I'm wondering if some information from the Request and/or Response might be helpful in constructing the message (here), or if you have other suggestions on how this might be made easier (without wrapping all code in try-catches).

I'm happy to help with implementation, but wanted to see if there was a better way to handle this before I dove in.

@nicosuave
Copy link

I think adding status code to the message would be appropriate, especially given that's the determinator of an ErrorResponse

@nicosuave
Copy link

I am happy to contribute, @jeremyrsmith – just not sure exactly where you are w/ #61

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