// SPDX-FileCopyrightText: Politik im Blick developers
// SPDX-FileCopyrightText: Wolfgang Silbermayr <wolfgang@silbermayr.at>
//
// SPDX-License-Identifier: AGPL-3.0-or-later OR EUPL-1.2

use snafu::Snafu;

#[derive(Debug, Snafu)]
#[snafu(visibility(pub))]
#[snafu(display("Error performing api authorization"))]
pub struct Error {
    source: Box<dyn std::error::Error + Send + Sync>,
}

impl Error {
    pub fn from_boxed_source(source: Box<dyn std::error::Error + Send + Sync>) -> Self {
        Self { source }
    }

    pub fn from_source<E: std::error::Error + Send + Sync + 'static>(source: E) -> Self {
        Self::from_boxed_source(Box::new(source))
    }
}
