Should error tuples return exception atoms or structs?
Closed this issue · 0 comments
XavKearney commented
Currently in GSS.Spreadsheet
, the type @type spreadsheet_response :: {:json, map()} | {:error, Exception.t} | no_return()
specifies that functions return an error tuple with an Exception
struct.
However, in the code (e.g. here), the return value is actually {:error, GSS.GoogleApiError}
where GSS.GoogleApiError
is an atom corresponding to the module and not the struct %GSS.GoogleApiError{}
.
I submitted a PR here which corrects some of the instances of Exception.t
to be atoms so that dialyzer is able to correctly type check. This isn't a complete solution - it may be better to convert all of the returns to the respective struct if that is what was intended.