Add .optional()
to database fetches that shouldn't throw an error for zero-result single-row-fetches.
#4601
Closed
5 tasks done
Labels
Requirements
Is your proposal related to a problem?
When doing a single-row DB fetch, diesel will throw an error if there is no row returned.
This affects
.get_result
,.first
, and maybe other aliases I'm unaware of.In the code, we have various wrappers / methods to prevent errors from zero result single-fetches, but we should just be using
.optional()
instead.As far as I'm aware, list fetches do not throw an error if there are zero results returned.
Describe the solution you'd like.
Use
.optional()
for single-fetches that shouldn't return an error.Grep for the expressions above, add
.optional()
, and trace down and remove any error-catching hacks.Describe alternatives you've considered.
NA
Additional context
#4580 (comment)
The text was updated successfully, but these errors were encountered: