18 lines
335 B
Rust
18 lines
335 B
Rust
|
use rocket::response::status::BadRequest;
|
||
|
use serde_json::json;
|
||
|
|
||
|
pub mod artist;
|
||
|
pub mod album;
|
||
|
pub mod track;
|
||
|
pub mod user;
|
||
|
|
||
|
|
||
|
type ApiError = BadRequest<serde_json::Value>;
|
||
|
type FallibleApiResponse = Result<serde_json::Value, ApiError>;
|
||
|
|
||
|
pub fn api_error(msg: &str) -> ApiError {
|
||
|
BadRequest(json!({
|
||
|
"error": msg
|
||
|
}))
|
||
|
}
|