This PR allows Execute() to actually return an error if a non 20x response is received from supabase.
What is the current behavior?
Currently, if an error is received, Execute() return a nil error and the response from supabase. This then requires the user to determine if an error occurred by the contents of the response bytes
ex:
resp, err := client.From("sometable").Insert(document, false, "", "", "").Execute()
// error will always be nil with current behavior, if (for example) sometable doesnt exist
if err != nil {
// nothing to handle
}
What is the new behavior?
resp, err := client.From("sometable").Insert(document, false, "", "", "").Execute()
// error will not be nil if any non 20x error is returned from supabase
if err != nil {
// print, or log, or return etc
fmt.Printf("ERROR: %s\n", err)
}
Additional context
I made two decisions that could be changed. The first was to include Hint and Details in the response struct, even though they are not used. The second was do do >= 300 vs 400 on the error check,
What kind of change does this PR introduce?
This PR allows Execute() to actually return an error if a non 20x response is received from supabase.
What is the current behavior?
Currently, if an error is received, Execute() return a nil error and the response from supabase. This then requires the user to determine if an error occurred by the contents of the response bytes
ex:
What is the new behavior?
Additional context
I made two decisions that could be changed. The first was to include
Hint
andDetails
in the response struct, even though they are not used. The second was do do >= 300 vs 400 on the error check,