summaryrefslogtreecommitdiff
path: root/src/channel/repo/channels.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-09-15 23:23:34 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-09-16 11:03:04 -0400
commit71780b29e73b5f943e7d6f1e0889da9112103bdb (patch)
tree081e688c850591255b4af0bdae19c47b420822c6 /src/channel/repo/channels.rs
parentc5434c066a21107dc146801f940b02d61d260555 (diff)
Expose sqlx errors directly in repo interfaces.
BoxedError conceals the exact nature of the error, which in turn prevents me from using sqlx::Error::RowNotFound to signal absences.
Diffstat (limited to 'src/channel/repo/channels.rs')
-rw-r--r--src/channel/repo/channels.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/channel/repo/channels.rs b/src/channel/repo/channels.rs
index fc52aa3..ab7489c 100644
--- a/src/channel/repo/channels.rs
+++ b/src/channel/repo/channels.rs
@@ -2,7 +2,6 @@ use std::fmt;
use sqlx::{sqlite::Sqlite, SqliteConnection, Transaction};
-use crate::error::BoxedError;
use crate::id::Id as BaseId;
pub trait Provider {
@@ -25,7 +24,7 @@ pub struct Channel {
impl<'c> Channels<'c> {
/// Create a new channel.
- pub async fn create(&mut self, name: &str) -> Result<Id, BoxedError> {
+ pub async fn create(&mut self, name: &str) -> Result<Id, sqlx::Error> {
let id = Id::generate();
let channel = sqlx::query_scalar!(
@@ -44,7 +43,7 @@ impl<'c> Channels<'c> {
Ok(channel)
}
- pub async fn by_id(&mut self, channel: Id) -> Result<Channel, BoxedError> {
+ pub async fn by_id(&mut self, channel: Id) -> Result<Channel, sqlx::Error> {
let channel = sqlx::query_as!(
Channel,
r#"
@@ -60,7 +59,7 @@ impl<'c> Channels<'c> {
Ok(channel)
}
- pub async fn all(&mut self) -> Result<Vec<Channel>, BoxedError> {
+ pub async fn all(&mut self) -> Result<Vec<Channel>, sqlx::Error> {
let channels = sqlx::query_as!(
Channel,
r#"