Skip to content

Commit

Permalink
fix: add comment explaining error handling in FromQueryResult derive
Browse files Browse the repository at this point in the history
  • Loading branch information
jreppnow committed Mar 30, 2024
1 parent a7bfac9 commit 14258a0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sea-orm-macros/src/derives/from_query_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ struct FromQueryResultItem {
pub ident: Ident,
}

/// Initially, we try to obtain the value for each field and check if it is an ordinary DB error
/// (which we return immediatly), or a null error.
///
/// ### Background
///
/// Null errors do not necessarily mean that the deserialization as a whole fails,
/// since structs embedding the current one might have wrapped the current one in an `Option`.
/// In this case, we do not want to swallow other errors, which are very likely to actually be
/// programming errors that should be noticed (and fixed).
struct TryFromQueryResultCheck<'a>(&'a FromQueryResultItem);

impl<'a> ToTokens for TryFromQueryResultCheck<'a> {
Expand Down

0 comments on commit 14258a0

Please sign in to comment.