aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/factoids/database.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/factoids/database.rs')
-rw-r--r--src/plugins/factoids/database.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/plugins/factoids/database.rs b/src/plugins/factoids/database.rs
index 1af586e..cb6f422 100644
--- a/src/plugins/factoids/database.rs
+++ b/src/plugins/factoids/database.rs
@@ -106,8 +106,8 @@ impl Database for MysqlConnection {
.execute(self) {
Ok(_) => DbResponse::Success,
Err(e) => {
- debug!("DB Insertion Error: {:?}", e);
- DbResponse::Failed("Database error - possible duplicate")
+ error!("DB Insertion Error: {:?}", e);
+ DbResponse::Failed("Failed to add factoid")
}
}
}
@@ -123,9 +123,15 @@ impl Database for MysqlConnection {
.filter(columns::name.eq(name))
.filter(columns::idx.eq(idx)))
.execute(self) {
- Ok(_) => DbResponse::Success,
+ Ok(v) => {
+ if v > 0 {
+ DbResponse::Success
+ } else {
+ DbResponse::Failed("Could not find any factoid with that name")
+ }
+ }
Err(e) => {
- debug!("DB Deletion Error: {:?}", e);
+ error!("DB Deletion Error: {:?}", e);
DbResponse::Failed("Failed to delete factoid")
}
}