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

Error handling for federation #1259

Closed
Nutomic opened this issue Nov 9, 2020 · 3 comments
Closed

Error handling for federation #1259

Nutomic opened this issue Nov 9, 2020 · 3 comments
Labels
area: federation support federation via activitypub enhancement New feature or request

Comments

@Nutomic
Copy link
Member

Nutomic commented Nov 9, 2020

We need to implement better error handling for our federation code. At the moment, most of it uses stringly typed errors, like Err(anyhow!("Activity is not addressed to public").into()). We should implement a separate error type instead, and make sure that returned status codes are in accordance with the activitypub standard.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@Nutomic
Copy link
Member Author

Nutomic commented Feb 5, 2021

Error codes are already correct as far as I see. As for the error messages, we could wrap them in an ApubError type, but in the end they are still going to be strings describing what went wrong, so I'm not sure if it would improve anything.

@dessalines
Copy link
Member

This doc really doesn't say anything about specific error messages, only that they return appropriate http error codes: https://www.w3.org/TR/activitypub/ . We're probably fine with string errors.

@Nutomic
Copy link
Member Author

Nutomic commented Feb 5, 2021

Actually, based on https://yerbamate.ml/LemmyNet/lemmy/pulls/165 it might be good to create an ApubError type like this, to help with debugging:

struct ApubError {
  inner: Option<anyhow::Error>, // the cause, if any
  apub_id: Url, // id of the object which caused the error (for debugging)
  message: String, // human readable description of what happened
  status_code: StatusCode, // if this error is served over http, use this as status code
}

@Nutomic Nutomic closed this as completed Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: federation support federation via activitypub enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants