Skip to content

Commit 33956e5

Browse files
committed
Minor fmt and doc changes
- use `DateTime` `Display` instead of `Debug` in `ParseTimestampError` `Display` - comments should go above `#[cfg(feature)]` - adds random comments
1 parent 49abe22 commit 33956e5

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

crates/devolutions-pedm/src/api/err.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use hyper::StatusCode;
66
use crate::db::DbError;
77

88
/// An error type for route handlers.
9+
///
10+
/// The error contains a status code and an optional error message.
911
#[derive(Debug)]
1012
pub(crate) struct HandlerError(StatusCode, Option<String>);
1113

crates/devolutions-pedm/src/db/err.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub enum DbError {
2020
/// For example, we may have a value that is `i16` in the data model but it is stored as `i64` in libSQL.
2121
#[cfg(feature = "libsql")]
2222
TryFromInt(TryFromIntError),
23+
/// An error that occurs when parsing microseconds since epoch into `chrono::DateTime<Utc>`.
2324
#[cfg(feature = "libsql")]
2425
Timestamp(ParseTimestampError),
2526
#[cfg(feature = "postgres")]
@@ -106,8 +107,8 @@ impl DbError {
106107
}
107108
}
108109

109-
#[cfg(feature = "libsql")]
110110
/// A custom error type equivalent for `chrono::LocalResult`.
111+
#[cfg(feature = "libsql")]
111112
#[derive(Debug)]
112113
pub enum ParseTimestampError {
113114
None,
@@ -127,7 +128,7 @@ impl fmt::Display for ParseTimestampError {
127128
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
128129
match self {
129130
Self::None => write!(f, "no timestamp found"),
130-
Self::Ambiguous(dt1, dt2) => write!(f, "ambiguous timestamp: {dt1:?} or {dt2:?}"),
131+
Self::Ambiguous(dt1, dt2) => write!(f, "ambiguous timestamp: {dt1} or {dt2}"),
131132
}
132133
}
133134
}

0 commit comments

Comments
 (0)