-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
df825d2
to
9a12b9f
Compare
Pull Request Test Coverage Report for Build 5739883496
💛 - Coveralls |
9a12b9f
to
8bbbfd6
Compare
8bbbfd6
to
40120df
Compare
40120df
to
9007d62
Compare
let query: Bytes = hyper::body::to_bytes(req.into_body()) | ||
.await | ||
.map_err(|e| { | ||
( | ||
StatusCode::BAD_REQUEST, | ||
axum::response::AppendHeaders([ | ||
(axum::http::header::CONTENT_TYPE, "application/json"), | ||
(HeaderName::from_static("graph-attestable"), "false"), | ||
]), | ||
Json(e), | ||
) | ||
}) | ||
.unwrap(); | ||
let query_string = String::from_utf8_lossy(&query); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want to actually respond with the error, instead of panicking and printing the HTTP response?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.unwrap()
s are still there, and will halt the program instead or returning an error HTTP response, or is there something I am misunderstanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right that the program will not return an HTTP response, it will just return curl: (52) Empty reply from server
if I do a simple curl with malformed query.
I was trying to avoid the long match/combinator statements, but now I've refactored so that program will return an error HTTP response, think it is much better:)
like this
"Indexer error: IE075, explanation: Failed to parse response body to query string, cause: IndexerErrorCause(FromUtf8Error { bytes: [240, 159, 144], error: Utf8Error { valid_up_to: 0, error_len: None } })
Note: this now outdated iteration of resolver function will indeed lead to a panick thread, but the program will not halt. The server would log something like below and continue serving future requests
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: (400, Json(FromUtf8Error { bytes: [240, 159, 144], error: Utf8Error { valid_up_to: 0, error_len: None } }))', service/src/server/routes/subgraphs.rs:71:10
73170f5
to
5af7190
Compare
.toml
file parsing for configurations, added exampletemplate.toml
fileResolves #7
Follow up issue #17 to complete the feature
I will try to split these up into smaller PRs in the future, kinda got carried away just doing things this time