L2-Technology / sensei

A lightning node implementation for everyone
https://l2.technology/sensei
Other
199 stars 39 forks source link

Expose more error information from http admin API #80

Open orbitalturtle opened 2 years ago

orbitalturtle commented 2 years ago

This PR aims to expose more information about the errors returned from the sensei api, to make things clearer for api users

Thought it would be good to get some feedback on the approach so far. But I would like to do the same for some of the other silenced errors in http/admin.rs, as well as get started on the http/node.rs errors

A little more specifically, this PR:

johncantrell97 commented 2 years ago

This is amazing and sorely needed. Thank you for working on this. I'll have to dig in a bit deeper but at first glance my only comment is can we try to keep axum/tonic and related content outside of "senseicore".

The idea of senseicore is to make it completely protocol agnostic so that it can be used as a library without any http/grpc dependencies.

I guess this might be a problem here though? Will you run into the 'you can't implement a trait for a type from another crate' issue?

Hm. If so then maybe it means we need to have some kind of "HttpError" struct that you can turn a regular SenseiError into and then implement IntoResponse for that?

Thoughts?

orbitalturtle commented 2 years ago

@johncantrell97 Ahhh I see. That makes sense. I'll try moving things around!

orbitalturtle commented 2 years ago

@johncantrell97 moved the IntoResponse out of senseicore & added a HttpError struct. Will fix the clippy errors at some point too, but in the meantime probably ready for another look :)