mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-13 09:52:00 -04:00
error: Split out error utils into a separate module
This commit is contained in:
parent
f4247de8c1
commit
fd500229d6
5 changed files with 29 additions and 18 deletions
23
src/error.rs
Normal file
23
src/error.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright © 2023 Collabora Ltd.
|
||||
* Copyright © 2024 Valve Software
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
use zbus::fdo;
|
||||
|
||||
pub fn to_zbus_fdo_error<S: ToString>(error: S) -> fdo::Error {
|
||||
fdo::Error::Failed(error.to_string())
|
||||
}
|
||||
|
||||
pub fn to_zbus_error<S: ToString>(error: S) -> zbus::Error {
|
||||
zbus::Error::Failure(error.to_string())
|
||||
}
|
||||
|
||||
pub fn zbus_to_zbus_fdo(error: zbus::Error) -> fdo::Error {
|
||||
match error {
|
||||
zbus::Error::FDO(error) => *error,
|
||||
error => fdo::Error::Failed(error.to_string()),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue