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

Improve HTTP responses #250

Closed
dora-gt opened this issue Aug 28, 2019 · 7 comments
Closed

Improve HTTP responses #250

dora-gt opened this issue Aug 28, 2019 · 7 comments

Comments

@dora-gt
Copy link
Member

dora-gt commented Aug 28, 2019

Currently HTTP endpoints return JSON like:

{"type":"about:blank","title":"Internal Server Error"}
or
{"type":"about:blank","title":"Bad Request"}

This tells nothing for developers and it's hard to assume what's the problem. We need to improve this.

https://interledger.slack.com/archives/CHC51E54J/p1566983918002000

@dora-gt dora-gt changed the title Improve http responses Improve HTTP responses Aug 28, 2019
@emschwartz emschwartz added this to To do in Hackathon Kit via automation Sep 17, 2019
@emschwartz
Copy link
Member

It looks like we can use https://github.com/dtolnay/path-to-error along with the error message returned by serde_json to provide a more helpful error message

@dora-gt
Copy link
Member Author

dora-gt commented Sep 23, 2019

Because the testnet document depends on test.xpring.tech, I'll try to improve this in parallel.

@dora-gt
Copy link
Member Author

dora-gt commented Sep 23, 2019

I think there are 2 options to implement this.

  1. Improve tower-web
  2. Implement extract trait on our own
    • If we implement on our own, it might be more flexible. We could specify our own types like https://errors.interledger.org/<api>/<error_type>.
    • I haven't dug into this approach yet enough.

If you @interledger-rs/contributors have any opinion, please tell me.

@emschwartz
Copy link
Member

I'm in the process of switching everything over to warp (away from tower-web) so I wouldn't focus on implementing this for tower-web.

warp gives you a bit more manual control over error handling so it shouldn't be too difficult to implement once we decide what we want. See how "rejections" are handled here. We can change our own ApiError type to include more details of the error and then change that error handling logic to include more details in the HTTP response body.

@dora-gt
Copy link
Member Author

dora-gt commented Sep 23, 2019

Ahhh! sorry, I forgot. Yes, we should use warp. Thank you. I'll check the code.

@emschwartz emschwartz moved this from To do to In progress (PRs & Issues) in Hackathon Kit Sep 23, 2019
dora-gt added a commit that referenced this issue Sep 28, 2019
Signed-off-by: Taiga Nakayama <dora@dora-gt.jp>

#250
dora-gt added a commit that referenced this issue Oct 15, 2019
Move the HTTP error module into `interledger-http` crate, fix ILP over HTTP API to return errors in
RFC7807 format.

Signed-off-by: Taiga Nakayama <dora@dora-gt.jp>

#250, #415
dora-gt added a commit that referenced this issue Oct 18, 2019
Move the HTTP error module into `interledger-http` crate, fix ILP over HTTP API to return errors in
RFC7807 format.

Signed-off-by: Taiga Nakayama <dora@dora-gt.jp>

#250, #415
dora-gt added a commit that referenced this issue Oct 21, 2019
Move the HTTP error module into `interledger-http` crate, fix ILP over HTTP API to return errors in
RFC7807 format.

Signed-off-by: Taiga Nakayama <dora@dora-gt.jp>

#250, #415
dora-gt added a commit that referenced this issue Oct 22, 2019
Move the HTTP error module into `interledger-http` crate, fix ILP over HTTP API to return errors in
RFC7807 format.

Signed-off-by: Taiga Nakayama <dora@dora-gt.jp>

#250, #415
dora-gt added a commit that referenced this issue Oct 22, 2019
Move the HTTP error module into `interledger-http` crate, fix ILP over HTTP API to return errors in
RFC7807 format.

Signed-off-by: Taiga Nakayama <dora@dora-gt.jp>

#250, #415
@gakonst
Copy link
Member

gakonst commented Dec 14, 2019

Closing, our error handling is very nice now

@gakonst gakonst closed this as completed Dec 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Hackathon Kit
  
In progress (PRs & Issues)
Development

No branches or pull requests

3 participants