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 da2d5eb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 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,14 @@ 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
struct TryFromQueryResultCheck<'a>(&'a FromQueryResultItem);

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

0 comments on commit da2d5eb

Please sign in to comment.