supabase / postgrest-dart

Dart client for PostgREST
https://supabase.com
MIT License
136 stars 38 forks source link

Error Parsing PostgrestError #25

Closed nstrelow closed 3 years ago

nstrelow commented 3 years ago

Error: type 'List<dynamic>' is not a subtype of type 'String?' in type cast

This needs to be a list:

https://github.com/supabase/postgrest-dart/blob/c8a571cfff9234fd9ba88baa1e3365581ca7de94/lib/src/postgrest_error.dart#L17

The json PostgREST returns:

{hint: By following the 'details' key, disambiguate the request by changing the url to /origin?select=relationship(*) or /origin?select=target!relationship(*), details: [{relationship: public.study_subject[user_study_studyId_fkey][study_subject_loginCode_fkey], origin: public.study, cardinality: m2m, target: public.study_invite}, {relationship: study_invite_studyId_fkey[id][studyId], origin: public.study, cardinality: o2m, target: public.study_invite}], message: More than one relationship was found for study and study_invite}

Where details is a List<Map<String,dynamic>>

phamhieu commented 3 years ago

fixed: https://github.com/supabase/postgrest-dart/commit/954c10c19140c3beab0cb800bcd0461f7335c3b6 by updating error.details to dynamic type

Thank you @nstrelow