Kestrel před 7 měsíci
rodič
revize
ad07e8ed59
4 změnil soubory, kde provedl 4 přidání a 7 odebrání
  1. 1 4
      microrm/Cargo.toml
  2. 1 1
      microrm/src/db.rs
  3. 1 1
      microrm/src/lib.rs
  4. 1 1
      microrm/src/query.rs

+ 1 - 4
microrm/Cargo.toml

@@ -17,12 +17,9 @@ all-features = true
 clap = ["dep:clap"]
 
 [dependencies]
-base64 = "0.13"
-sha2 = "0.10"
 libsqlite3-sys = "0.28"
-serde = { version = "1.0", features = ["derive"] }
+serde = { version = "1.0" }
 serde_json = { version = "1.0" }
-lazy_static = { version = "1.4.0" }
 time = "0.3"
 
 microrm-macros = { path = "../microrm-macros", version = "0.4.0-rc.1" }

+ 1 - 1
microrm/src/db.rs

@@ -368,7 +368,7 @@ impl<'a> StatementContext<'a> {
                     .unwrap()
                     .to_string();
                 log::trace!("SQLite constraint violation: {msg}");
-                Err(Error::ConstraintViolation(""))
+                Err(Error::ConstraintViolation(msg))
             }
             err => {
                 log::trace!("unexpected error during sqlite3_step: {:?}", err);

+ 1 - 1
microrm/src/lib.rs

@@ -124,7 +124,7 @@ pub enum Error {
     LogicError(&'static str),
     /// Attempted to insert an entity with values that violate a database constraint, probably
     /// due to a uniqueness requirement.
-    ConstraintViolation(&'static str),
+    ConstraintViolation(String),
     /// Sqlite internal error that has not been translated into a more specific error.
     Sqlite {
         /// SQLite internal error code.

+ 1 - 1
microrm/src/query.rs

@@ -363,7 +363,7 @@ fn do_connect<Remote: Entity>(
             ctx.bind(2, remote_id.into_raw())?;
 
             ctx.run()?
-                .ok_or(Error::ConstraintViolation("Already connected"))
+                .ok_or(Error::ConstraintViolation("Relation entry uniqueness".to_string()))
                 .map(|_| ())
         },
     )