Skip to main content

ocm_types/
error.rs

1// SPDX-FileCopyrightText: 2026 Matthias Kraus <info@opengeomesh.org>
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5use serde::{Deserialize, Serialize};
6
7
8#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct Error {
11    /// An error message which is understandable for both humans and
12    /// machines (e.g. no use of special characters) providing more
13    /// information on the cause of the error.
14    /// example: RESOURCE_NOT_FOUND
15    pub message: String,
16    pub validation_errors: Vec<ValidationError>,
17}
18
19#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
20#[serde(rename_all = "camelCase")]
21pub struct ValidationError {
22    /// example: shareWith
23    pub name: Option<String>,
24    /// A validation error message which is understandable for
25    /// both humans and machines (e.g. no use of special
26    /// characters) providing more information on the cause of the
27    /// validation error.
28    /// example: NOT_FOUND
29    pub message: Option<String>,
30}