Commit 1970893a authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot

Merge topic 'non-exhaustive-errors'

4d68c232 changelog: fix style of old notes
0581d1e9 clippy: use #[non_exhaustive]
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Brad King's avatarBrad King <brad.king@kitware.com>
Merge-request: !269
parents 9221832e 4d68c232
# v0.1303.1 (unreleased)
## Changes
* Error types now use `#[non_exhaustive]`
# v0.1303.0
## Additions
- Added `gitlab::webhooks::PipelineHook`
* Added `gitlab::webhooks::PipelineHook`
# v0.1302.2
## Additions
- `Id` types now implement `Hash`
* `Id` types now implement `Hash`
# v0.1302.1
## Additions
- Added `api::projects::issues::MergeRequestsClosing` and
`api::projects::issues::MergeRequestsClosing`
* Added `api::projects::issues::MergeRequestsClosing` and
`api::projects::issues::MergeRequestsClosing`
## Fixes
......
......@@ -12,8 +12,8 @@ use thiserror::Error;
use crate::api::PaginationError;
/// Errors which may occur when creating form data.
#[non_exhaustive]
#[derive(Debug, Error)]
// TODO #[non_exhaustive]
pub enum BodyError {
/// Body data could not be serialized from form parameters.
#[error("failed to URL encode form parameters: {}", source)]
......@@ -22,17 +22,11 @@ pub enum BodyError {
#[from]
source: serde_urlencoded::ser::Error,
},
/// This is here to force `_` matching right now.
///
/// **DO NOT USE**
#[doc(hidden)]
#[error("unreachable...")]
_NonExhaustive,
}
/// Errors which may occur when using API endpoints.
#[non_exhaustive]
#[derive(Debug, Error)]
// TODO #[non_exhaustive]
pub enum ApiError<E>
where
E: Error + Send + Sync + 'static,
......@@ -97,12 +91,6 @@ where
#[from]
source: PaginationError,
},
/// This is here to force `_` matching right now.
///
/// **DO NOT USE**
#[doc(hidden)]
#[error("unreachable...")]
_NonExhaustive,
}
impl<E> ApiError<E>
......
......@@ -12,8 +12,8 @@ use url::Url;
use crate::api::{query, ApiError, Client, Endpoint, Query};
/// Errors which may occur with pagination.
#[non_exhaustive]
#[derive(Debug, Error)]
// TODO #[non_exhaustive]
pub enum PaginationError {
/// A `Link` HTTP header can fail to parse.
#[error("failed to parse a Link HTTP header: {}", source)]
......@@ -29,12 +29,6 @@ pub enum PaginationError {
#[from]
source: url::ParseError,
},
/// This is here to force `_` matching right now.
///
/// **DO NOT USE**
#[doc(hidden)]
#[error("unreachable...")]
_NonExhaustive,
}
#[derive(Debug)]
......
......@@ -8,20 +8,14 @@ use http::{HeaderMap, HeaderValue};
use log::error;
use thiserror::Error;
#[non_exhaustive]
#[derive(Debug, Error)]
// TODO #[non_exhaustive]
pub enum AuthError {
#[error("header value error: {}", source)]
HeaderValue {
#[from]
source: http::header::InvalidHeaderValue,
},
/// This is here to force `_` matching right now.
///
/// **DO NOT USE**
#[doc(hidden)]
#[error("unreachable...")]
_NonExhaustive,
}
type AuthResult<T> = Result<T, AuthError>;
......
......@@ -24,8 +24,8 @@ use crate::api::{self, Query};
use crate::auth::{Auth, AuthError};
use crate::types::*;
#[non_exhaustive]
#[derive(Debug, Error)]
// TODO #[non_exhaustive]
pub enum GitlabError {
#[error("failed to parse url: {}", source)]
UrlParse {
......@@ -59,12 +59,6 @@ pub enum GitlabError {
#[from]
source: api::ApiError<RestError>,
},
/// This is here to force `_` matching right now.
///
/// **DO NOT USE**
#[doc(hidden)]
#[error("unreachable...")]
_NonExhaustive,
}
impl GitlabError {
......@@ -277,8 +271,8 @@ impl Gitlab {
}
}
#[non_exhaustive]
#[derive(Debug, Error)]
// TODO #[non_exhaustive]
pub enum RestError {
#[error("error setting auth header: {}", source)]
AuthError {
......@@ -295,12 +289,6 @@ pub enum RestError {
#[from]
source: http::Error,
},
/// This is here to force `_` matching right now.
///
/// **DO NOT USE**
#[doc(hidden)]
#[error("unreachable...")]
_NonExhaustive,
}
impl api::Client for Gitlab {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment