Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding error response interfaces #806

Open
Maxim-Mazurok opened this issue Mar 6, 2023 · 1 comment
Open

Consider adding error response interfaces #806

Maxim-Mazurok opened this issue Mar 6, 2023 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed investigation Needs to be investigated

Comments

@Maxim-Mazurok
Copy link
Owner

Maxim-Mazurok commented Mar 6, 2023

{
  "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.

@Maxim-Mazurok Maxim-Mazurok added enhancement New feature or request help wanted Extra attention is needed investigation Needs to be investigated labels Mar 6, 2023
@dhakan
Copy link

dhakan commented Mar 7, 2023

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed investigation Needs to be investigated
Projects
None yet
Development

No branches or pull requests

2 participants