//
// Copyright 2023 Zesty Tech Ltd. All rights reserved.
// Use is subject to license terms.
//
use serde_json as json;
use thiserror::Error;
use super::*;
#[derive(Debug, Error, Serialize, Deserialize)]
#[error("{message}")]
pub struct Error {
#[serde(with = "http_serde::status_code")]
pub status: http::StatusCode,
pub message: String,
}
impl From<json::Error> for Error {
fn from(error: json::Error) -> Self {
let status = http::StatusCode::INTERNAL_SERVER_ERROR;
let message = error.to_string();
Self { status, message }
}
}