Consider adding error response interfaces
Opened this issue · 1 comments
Maxim-Mazurok commented
{ "error": { "code": 403, "message": "The video identified by the <code><a href=\"/youtube/v3/docs/commentThreads/list#videoId\">videoId</a></code> parameter has disabled comments.", "errors": [ { "message": "The video identified by the <code><a href=\"/youtube/v3/docs/commentThreads/list#videoId\">videoId</a></code> parameter has disabled comments.", "domain": "youtube.commentThread", "reason": "commentsDisabled", "location": "videoId", "locationType": "parameter" } ] } }This is not something that I could find an interface for. Is this handled by type definitions found elsewhere?
That's an excellent question, I didn't find any interfaces for errors either. I'll create an issue to look into that.
Originally posted by @Maxim-Mazurok in #800 (comment)
Basically, sometimes Google APIs reply with errors, and I couldn't find any types/interfaces that would handle that. Maybe check in https://github.com/Maxim-Mazurok/gapi how they handle errors, that might reveal the exact types of the errors. Or check docs, I didn't check them yet. Looked in all gapi-related projects on DT tho.
dhakan commented
This is the interface I created to handle the disabled comment threads response:
interface Error {
message: string;
domain: string;
reason: string;
location: string;
locationType: string;
}
interface ErrorResponse {
error: {
code: number;
message: string;
errors: Error[];
};
}
Maybe it helps :)