about summary refs log tree commit diff
path: root/src/database/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/mod.rs')
-rw-r--r--src/database/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/database/mod.rs b/src/database/mod.rs
index 57223f8..0d98dd4 100644
--- a/src/database/mod.rs
+++ b/src/database/mod.rs
@@ -35,12 +35,14 @@ pub enum ErrorKind {
     /// The user's query or request to the database was malformed. Used whenever the database processes
     /// the user's query directly, such as when editing posts inside of the database (e.g. Redis backend)
     BadRequest,
+    /// the user's query collided with an in-flight request and needs to be retried
+    Conflict,
     ///  - ErrorKind::Other - when something so weird happens that it becomes undescribable.
     Other,
 }
 
 /// Enum representing settings that might be stored in the site's database.
-#[derive(Serialize, Debug, Clone, Copy)]
+#[derive(Deserialize, Serialize, Debug, Clone, Copy)]
 #[serde(rename_all = "snake_case")]
 pub enum Settings {
     /// The name of the website -- displayed in the header and the browser titlebar.
@@ -87,6 +89,7 @@ impl std::fmt::Display for StorageError {
             ErrorKind::PermissionDenied => write!(f, "permission denied: "),
             ErrorKind::NotFound => write!(f, "not found: "),
             ErrorKind::BadRequest => write!(f, "bad request: "),
+            ErrorKind::Conflict => write!(f, "conflict with an in-flight request or existing data: "),
             ErrorKind::Other => write!(f, "generic storage layer error: "),
         } {
             Ok(_) => write!(f, "{}", self.msg),