2023-04-21 16:18:20 +02:00
|
|
|
use custom_error::custom_error;
|
|
|
|
|
|
|
|
custom_error! {
|
|
|
|
#[derive(PartialEq, Eq)]
|
2023-04-21 23:20:23 +02:00
|
|
|
pub FieldFormatError
|
2023-04-21 16:18:20 +02:00
|
|
|
PasswordError = "Password must be between 1 and 72 characters.",
|
|
|
|
UsernameError = "Username must be between 2 and 32 characters.",
|
|
|
|
ConsentError = "Consent must be 'true' to register.",
|
2023-04-22 11:32:44 +02:00
|
|
|
EmailError = "The provided email address is in an invalid format.",
|
2023-04-21 16:18:20 +02:00
|
|
|
}
|
2023-04-21 18:20:49 +02:00
|
|
|
|
|
|
|
custom_error! {
|
|
|
|
#[derive(PartialEq, Eq)]
|
|
|
|
pub InstanceServerError
|
2023-04-21 23:20:23 +02:00
|
|
|
NoResponse = "Did not receive a response from the Server.",
|
|
|
|
RequestErrorError{url:String, error:String} = "An error occured while trying to GET from {url}: {error}",
|
|
|
|
ReceivedErrorCodeError{error_code:String} = "Received the following error code while requesting from the route: {error_code}",
|
2023-04-22 11:32:44 +02:00
|
|
|
CantGetInfoError{error:String} = "Something seems to be wrong with the instance. Cannot get information about the instance: {error}",
|
2023-04-22 22:12:56 +02:00
|
|
|
InvalidFormBodyError{error_type: String, error:String} = "The server responded with: {error_type}: {error}",
|
2023-04-21 18:20:49 +02:00
|
|
|
}
|