Skip to main content

opentalk_nextcloud_client/
error.rs

1// SPDX-FileCopyrightText: OpenTalk GmbH <mail@opentalk.eu>
2//
3// SPDX-License-Identifier: EUPL-1.2
4
5use reqwest::StatusCode;
6use snafu::Snafu;
7
8use crate::ShareId;
9
10#[derive(Debug, Snafu)]
11#[snafu(visibility(pub(crate)))]
12pub enum Error {
13    #[snafu(context(false), display("URL parse error: {source}",))]
14    UrlParse { source: url::ParseError },
15
16    #[snafu(context(false), display("Reqwest DAV error: {source}",))]
17    ReqwestDav { source: reqwest_dav::Error },
18
19    #[snafu(context(false), display("Reqwest error: {source}",))]
20    Reqwest { source: reqwest::Error },
21
22    #[snafu(display("Server returned unauthorized error"))]
23    Unauthorized,
24
25    #[snafu(display("Unknown share type"))]
26    UnknownShareType,
27
28    #[snafu(display("Public upload was disabled by the admin"))]
29    PublicUploadDisabledByAdmin,
30
31    #[snafu(display("File could not be shared"))]
32    FileCouldNotBeShared,
33
34    #[snafu(display("Server sent unexpected status code: {status_code}",))]
35    UnexpectedStatusCode { status_code: StatusCode },
36
37    #[snafu(display("Wrong or no update parameter given"))]
38    WrongParameter,
39
40    #[snafu(display("Share {share_id} not found",))]
41    ShareNotFound { share_id: ShareId },
42
43    #[snafu(display("File {file_path} not found",))]
44    FileNotFound {
45        file_path: String,
46        source: reqwest_dav::Error,
47    },
48}