Skip to content

Commit 8a36fd4

Browse files
authored
extend error types to impl serialization (#797)
1 parent cb80b66 commit 8a36fd4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/error.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77
};
88

99
use bson::Bson;
10-
use serde::Deserialize;
10+
use serde::{Deserialize, Serialize};
1111
use thiserror::Error;
1212

1313
use crate::{bson::Document, options::ServerAddress, sdam::TopologyVersion};
@@ -597,7 +597,7 @@ impl ErrorKind {
597597
}
598598

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

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

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

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

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

771771
/// An error that occurred when trying to execute a write operation.
772-
#[derive(Clone, Debug)]
772+
#[derive(Clone, Debug, Serialize, Deserialize)]
773773
#[non_exhaustive]
774774
pub enum WriteFailure {
775775
/// An error that occurred due to not being able to satisfy a write concern.

0 commit comments

Comments
 (0)