You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Calendar API, methods will throw an error, but there is no way to access the type of this error via TypeScript.
It appears this error is either a GaxiosError or RequestError from the form (properties include response, config, code, errors). However, the only error interface export from calendar_v3 is Schema$Error, which is an incomplete description of the actual API-specific error provided under the errors property of the error thrown.
I searched the entire TypeScript definition file and could not find any error interface exported by googleapis that could be used to properly type the error being thrown (in my specific case, from calendar_v3.Resource$Events.list).
It would be helpful if a GoogleApiError interface was defined that defined the specific shape of a Google API error, or, if that is not possible, API specific error types such as GoogleCalendarApiError.
At a minimum, it would be nice to at least re-export the GaxiosError, so the gaxios package does not have to be added as a dependency and kept in sync just to access this type. But since the implementation might change in the future away from Gaxios, it would be preferred to export a package-specific error that also includes the errors property added by at least the Calendar API calls:
Finally, it would also be helpful if some documentation was added on how to use these types. For instance, it took me over an hour to figure out that I could access the error schema for the Calendar via:
import { calendar_v3 } from 'googleapis';
import CalendarError = calendar_v3.Schema$Error;
The text was updated successfully, but these errors were encountered:
When using the Calendar API, methods will throw an error, but there is no way to access the type of this error via TypeScript.
It appears this error is either a
GaxiosError
orRequestError
from the form (properties includeresponse
,config
,code
,errors
). However, the only error interface export fromcalendar_v3
isSchema$Error
, which is an incomplete description of the actual API-specific error provided under theerrors
property of the error thrown.I searched the entire TypeScript definition file and could not find any error interface exported by
googleapis
that could be used to properly type the error being thrown (in my specific case, fromcalendar_v3.Resource$Events.list
).It would be helpful if a
GoogleApiError
interface was defined that defined the specific shape of a Google API error, or, if that is not possible, API specific error types such asGoogleCalendarApiError
.At a minimum, it would be nice to at least re-export the
GaxiosError
, so thegaxios
package does not have to be added as a dependency and kept in sync just to access this type. But since the implementation might change in the future away from Gaxios, it would be preferred to export a package-specific error that also includes theerrors
property added by at least the Calendar API calls:Finally, it would also be helpful if some documentation was added on how to use these types. For instance, it took me over an hour to figure out that I could access the error schema for the Calendar via:
The text was updated successfully, but these errors were encountered: