Docs.rs: "Internal Server Error" for /builds and /features when release does not exist

Created on 13 Dec 2020  路  4Comments  路  Source: rust-lang/docs.rs

If I visit https://docs.rs/crate/{name}/{version}/builds or https://docs.rs/crate/{name}/{version}/features with an invalid combination of name and version (i.e. a release that doesn't exist) I get an Internal server error. I only got there by manually typing in a version number for a crate that never existed.

Expected Behavior

An error page with The requested crate does not exist.

Actual Behavior

An error page with Internal Server Error

Example

https://docs.rs/crate/serde/2.0.0/builds

Probable Cause

The crate_details handler wraps most of its logic into a match_version call that early-returns Err(Nope::CrateNotFound) when no crate is found. That turns into an IronError and produces the expected error page while the rest of the handler can assume that there is an actual release to work with.

The features handler does not use such a wrapper and just fails on an assertion in /src/web/features.rs. This also has the effect that
https://docs.rs/crate/serde/1.0.118, https://docs.rs/crate/serde/latest and https://docs.rs/crate/serde/1.0.118/features work, but https://docs.rs/crate/serde/latest/features does not.

A-backend C-bug E-easy

All 4 comments

Sounds like you understand exactly what's breaking and why :) are you interested in writing up a fix? Like you said, it should be as simple as calling match_version on the version, that would account for semantic versioning too which currently doesn't happen.

@Xiphoseer are you currently tackling this? If not, I'd love to pick it up.

@Xiphoseer are you currently tackling this? If not, I'd love to pick it up.

No, I'm not.

PR filed! #1236

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cynecx picture cynecx  路  4Comments

QuietMisdreavus picture QuietMisdreavus  路  4Comments

jyn514 picture jyn514  路  4Comments

pietroalbini picture pietroalbini  路  4Comments

spacejam picture spacejam  路  3Comments