postgrest-js icon indicating copy to clipboard operation
postgrest-js copied to clipboard

`error` is returned as `[]` if `.update()` matched no records

Open p-schneid opened this issue 2 years ago • 4 comments

Feature request

Is your feature request related to a problem? Please describe.

This is not a feature, so much as an improvement. I noticed when preforming an update, the response returns an error if the request didn't match any records. This is expected. However the response.error comes back as a empty array, which is not very helpful. A message could make error handling and debugging easier for consumers.

Describe the solution you'd like

A message indicating the request did not match any existing records

Describe alternatives you've considered

I stop whining about missing error messages. After all, the response does return a 404.

Additional context

image

p-schneid avatar Aug 08 '22 21:08 p-schneid

Thanks! This seems to be a bug. ~~Can you provide the supabase-js version you used?~~ Nvm, was able to reproduce this on the latest version.

soedirgo avatar Aug 09 '22 08:08 soedirgo

Related https://github.com/PostgREST/postgrest/issues/2343

steve-chavez avatar Aug 09 '22 17:08 steve-chavez

Same issue when .range() is not satisfiable: #324.

soedirgo avatar Sep 08 '22 09:09 soedirgo

Just to be clear, on this issue there is no error message in the response body coming from the server, only a 4xx status. This needs a fix on the PostgREST side.

steve-chavez avatar Sep 08 '22 23:09 steve-chavez