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

feat: html error handling #628

Merged
merged 2 commits into from
Dec 21, 2022
Merged

feat: html error handling #628

merged 2 commits into from
Dec 21, 2022

Conversation

Arqu
Copy link
Collaborator

@Arqu Arqu commented Dec 20, 2022

@Arqu Arqu added this to the v0.2.0 milestone Dec 20, 2022
@Arqu Arqu self-assigned this Dec 20, 2022
.await
.map_err(|e| GatewayError::new(StatusCode::INTERNAL_SERVER_ERROR, &e))?;
// TODO: handle 404 or error
let path_metadata = match state.client.retrieve_path_metadata(path.clone()).await {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@b5 this is the crucial bit - the earliest moment we ping store/p2p. I've updated error responses from fetch_gateway and fetch_bitswap so that it now catches them and returns a more sane response (failed to find {cid} || offline).
We should do similar for fetch_store to make it less jarring to the end users.

dignifiedquire
dignifiedquire previously approved these changes Dec 20, 2022
Copy link
Contributor

@dignifiedquire dignifiedquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests :P ?

let path_metadata = match state.client.retrieve_path_metadata(path.clone()).await {
Ok(metadata) => metadata,
Err(e) => {
if e == "offline" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭

@Arqu Arqu merged commit 4499a42 into main Dec 21, 2022
@Arqu Arqu deleted the arqu/404 branch December 21, 2022 11:34
ppodolsky pushed a commit to izihawa/iroh that referenced this pull request Dec 28, 2022
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

Successfully merging this pull request may close these issues.

gateway(template): improve 404 handling
2 participants