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/errors.rs

34 lines
1.0 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<T> From<YacError> for Result<T, (String, u32)> {
fn from(err: YacError) -> Self {
Err((err.message, err.code))
}
}