Skip to content

Commit

Permalink
fix: detection of maybeSingle
Browse files Browse the repository at this point in the history
On PostgREST 11.2.0, the format of the error got changed on PostgREST/postgrest#2876 to "The result contains 0 rows".

Change the detection to "0 rows". This should be backwards compatible.
  • Loading branch information
steve-chavez authored and soedirgo committed Oct 12, 2023
1 parent 7b0a696 commit 18f580c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PostgrestBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default abstract class PostgrestBuilder<Result>
}
}

if (error && this.isMaybeSingle && error?.details?.includes('Results contain 0 rows')) {
if (error && this.isMaybeSingle && error?.details?.includes('0 rows')) {
error = null
status = 200
statusText = 'OK'
Expand Down

0 comments on commit 18f580c

Please sign in to comment.