yac
/
yacexits
Archived
3
0
Fork 0
This repository has been archived on 2024-04-25. You can view files and clone it, but cannot push or open issues or pull requests.
yacexits/src/entry/errors.rs

41 lines
1.2 KiB
Rust

/*
* Copyright (c) 2023 Emma Tebibyte <emma@tebibyte.media>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of yacexits.
*
* Yacexits is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Yacexits is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with yacexits. If not, see <https://www.gnu.org/licenses/>.
*/
use alloc::string::String;
#[allow(dead_code)]
pub struct YacError {
pub code: u32,
pub message: String,
}
impl From<YacError> for (String, u32) {
fn from(err: YacError) -> Self {
(err.message, err.code)
}
}
impl From<(String, u32)> for YacError {
fn from(err: (String, u32)) -> Self {
let (message, code) = err;
YacError { message, code }
}
}