Installation:

toml [dependencies] axum_error_macro = { version = "0.1.0" }

Simple example

```rust use axumerrormacro::ErrorResponse;

[derive(ErrorResponse)]

enum Error { #[error(code = 500, msg = "Internal Server Error!!!")] InternalServerError,

#[error(code = 400, msg = "Bad Request!!!")] BadRequest,

#[error(code = 404, msg = "User by {} id was not found")] UserByIdNotFound(u32),

#[error(code = 404, msg = "User by {} username with {} role was not found")] UserByUsernameAndRoleNotFound(String, String),

#[error(code = 404, msg = "User {:?} was not found")] UserNotFound(User) }

[derive(Debug)]

struct User { username: String }

fn servererrorhandler() -> Error { return Error::InternalServerError.into_response(); }

fn userbyidhandler() -> Error { return Error::UserByIdNotFound(1).intoresponse(); }

fn userbyusernameandrolehandler() -> Error { return Error::UserByUsernameAndRoleNotFound("Bebra".into(), "ADMIN".into()).intoresponse(); }

fn userhandler() -> Error { let user = User { username: "Bebra".into() }; return Error::UserNotFound(user).intoresponse(); } ```