Skip to content

Remove obsolete cargo_err() fn #8030

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

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/util/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ pub(crate) use json::{custom, InsecurelyGeneratedTokenRevoked, ReadOnlyMode, Too

pub type BoxedAppError = Box<dyn AppError>;

/// Returns an error with status 200 and the provided description as JSON
///
/// This is for backwards compatibility with cargo endpoints. For all other
/// endpoints, use helpers like `bad_request` or `server_error` which set a
/// correct status code.
pub fn cargo_err<S: ToString>(error: S) -> BoxedAppError {
custom(StatusCode::OK, error.to_string())
}

// The following are intended to be used for errors being sent back to the Ember
// frontend, not to cargo as cargo does not handle non-200 response codes well
// (see <https://github.com/rust-lang/cargo/issues/3995>), but Ember requires
Expand Down Expand Up @@ -302,9 +293,6 @@ mod tests {
);
assert_eq!(not_found().response().status(), StatusCode::NOT_FOUND);

// cargo_err errors are returned as 200 so that cargo displays this nicely on the command line
assert_eq!(cargo_err("").response().status(), StatusCode::OK);

// All other error types are converted to internal server errors
assert_eq!(
internal("").response().status(),
Expand Down