Derive Macrosยง
- This derive macro is used to convert an enum into an ApiError.
You can use it by adding the#[derive(AsApiError)]
attribute to your enum.
By default, the kind issnake case
.
#[error(kind = "your_message_id")]
attribute to the variant.
You can also add a custom code to the error by adding the#[error(code = 400)]
attribute to the variant.
The following status are available and return the corresponding status code: