mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-24 08:42:23 +02:00
* Added Resolve - Probe fairness to avoid probe starvation * Added Probe setting to setup wizard * Playlist sort order fix
61 lines
1.2 KiB
Rust
61 lines
1.2 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
use std::collections::HashMap;
|
|
use thiserror::Error as ThisError;
|
|
|
|
/// Conduit api error info for Unprocessable Entity error
|
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ErrorSetInfo {
|
|
pub errors: HashMap<String, Vec<String>>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ErrorInfo {
|
|
pub error: String,
|
|
}
|
|
|
|
/// Define all possible errors
|
|
#[derive(ThisError, Clone, Debug, PartialEq, Eq)]
|
|
pub enum Error {
|
|
/// 400
|
|
#[error("{0}")]
|
|
BadRequest(String),
|
|
|
|
/// 401
|
|
#[error("Unauthorized")]
|
|
Unauthorized,
|
|
|
|
/// 403
|
|
#[error("{0}")]
|
|
Forbidden(String),
|
|
|
|
/// 404
|
|
#[error("Not Found")]
|
|
NotFound,
|
|
|
|
/// 409
|
|
#[error("{0}")]
|
|
Conflict(String),
|
|
|
|
/// 428
|
|
#[error("{0}")]
|
|
PreconditionRequired(String),
|
|
|
|
/// 422
|
|
#[error("Unprocessable Entity: {0:?}")]
|
|
UnprocessableEntity(ErrorSetInfo),
|
|
|
|
/// 500
|
|
#[error("{0}")]
|
|
InternalServerError(String),
|
|
|
|
/// serde deserialize error
|
|
#[error("Deserialize Error")]
|
|
DeserializeError,
|
|
|
|
/// request error
|
|
#[error("Http Request Error")]
|
|
RequestError,
|
|
}
|