Skip to content

extend error types to impl serialization #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
};

use bson::Bson;
use serde::Deserialize;
use serde::{Deserialize, Serialize};
use thiserror::Error;

use crate::{bson::Document, options::ServerAddress, sdam::TopologyVersion};
Expand Down Expand Up @@ -597,7 +597,7 @@ impl ErrorKind {
}

/// An error that occurred due to a database command failing.
#[derive(Clone, Debug, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[non_exhaustive]
pub struct CommandError {
/// Identifies the type of error.
Expand Down Expand Up @@ -637,7 +637,7 @@ impl fmt::Display for CommandError {
}

/// An error that occurred due to not being able to satisfy a write concern.
#[derive(Clone, Debug, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[non_exhaustive]
pub struct WriteConcernError {
/// Identifies the type of write concern error.
Expand Down Expand Up @@ -673,7 +673,7 @@ impl WriteConcernError {

/// An error that occurred during a write operation that wasn't due to being unable to satisfy a
/// write concern.
#[derive(Clone, Debug, PartialEq, Deserialize)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct WriteError {
/// Identifies the type of write error.
Expand Down Expand Up @@ -707,7 +707,7 @@ impl WriteError {

/// An error that occurred during a write operation consisting of multiple writes that wasn't due to
/// being unable to satisfy a write concern.
#[derive(Debug, PartialEq, Clone, Deserialize)]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct BulkWriteError {
/// Index into the list of operations that this error corresponds to.
Expand Down Expand Up @@ -744,7 +744,7 @@ impl BulkWriteError {
}

/// The set of errors that occurred during a write operation.
#[derive(Clone, Debug, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct BulkWriteFailure {
Expand All @@ -769,7 +769,7 @@ impl BulkWriteFailure {
}

/// An error that occurred when trying to execute a write operation.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[non_exhaustive]
pub enum WriteFailure {
/// An error that occurred due to not being able to satisfy a write concern.
Expand Down