ya_client_model/
error_message.rs

1/*
2 * Yagna Activity API
3 *
4 * It conforms with capability level 1 of the [Activity API specification](https://golem-network.gitbook.io/golem-internal-documentation-test/golem-activity-protocol/golem-activity-api).
5 *
6 * The version of the OpenAPI document: v1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13#[derive(thiserror::Error, Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
14#[error("Yagna API error: {message:?}")]
15pub struct ErrorMessage {
16    pub message: Option<String>,
17}
18
19impl ErrorMessage {
20    pub fn new(message: impl ToString) -> ErrorMessage {
21        ErrorMessage {
22            message: Some(message.to_string()),
23        }
24    }
25}
26
27impl<T: Into<String>> From<T> for ErrorMessage {
28    fn from(s: T) -> Self {
29        Self::new(s.into())
30    }
31}