ant_node_manager/
error.rs

1// Copyright 2024 MaidSafe.net limited.
2//
3// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
4// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
5// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6// KIND, either express or implied. Please review the Licences for the specific language governing
7// permissions and limitations relating to use of the SAFE Network Software.
8
9use thiserror::Error;
10
11pub type Result<T, E = Error> = std::result::Result<T, E>;
12
13#[derive(Debug, Error)]
14pub enum Error {
15    #[error(transparent)]
16    Json(#[from] serde_json::Error),
17    #[error(transparent)]
18    Io(#[from] std::io::Error),
19    #[error("The PID of the process was not found after starting it.")]
20    PidNotFoundAfterStarting,
21    #[error("The PID of the process was not set.")]
22    PidNotSet,
23    #[error(transparent)]
24    SemverError(#[from] semver::Error),
25    #[error("Unable to remove a running service {0:?}, stop this service first before removing")]
26    ServiceAlreadyRunning(Vec<String>),
27    #[error("The service(s) is not running: {0:?}")]
28    ServiceNotRunning(Vec<String>),
29    #[error(transparent)]
30    ServiceManagementError(#[from] ant_service_management::Error),
31    #[error("The service status is not as expected. Expected: {expected:?}")]
32    ServiceStatusMismatch {
33        expected: ant_service_management::ServiceStatus,
34    },
35}