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

PDS: Better Error Messages #8

Open
rudyfraser opened this issue Jun 24, 2024 · 0 comments
Open

PDS: Better Error Messages #8

rudyfraser opened this issue Jun 24, 2024 · 0 comments

Comments

@rudyfraser
Copy link
Member

Implement error handling and responses for all endpoints that returns the most appropriate status code for a given error and outputs messages that match the canonical Typescript PDS repo and/or lexicon outputs.

A flexible way to handle this (from the Rocket.rs docs) is using an enum that derives Responder as follows:

use rocket::fs::NamedFile;

#[derive(Responder)]
enum Error {
    #[response(status = 500, content_type = "json")]
    A(String),
    #[response(status = 404)]
    B(NamedFile, ContentType),
    C {
        inner: (Status, Option<String>),
        header: ContentType,
    }
}```

@rudyfraser rudyfraser changed the title Better Error Messages PDS: Better Error Messages Sep 14, 2024
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

No branches or pull requests

1 participant