Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

All response models fields being undefined and nullables #3629

kostas-pblworks started this conversation in General
Discussion options

Apologies if I'm missing something but why are all fields in all response models possibly undefined and nullables?

We're writing snippets of code that look like this:

try {
    const res = await drive.files.create({
      requestBody,
    })

    // Question: is it ever possible that the function above will succeed, 
    // res.data will be defined but the id will not be?
    if (!res.data.id) {
      throw new GoogleDriveError(
        'Create folder returned an object without an id',
        {
          requestBody,
          statusText: res.statusText,
          status: res.status,
        }
      )
    }

    return res.data
  } catch (error: unknown) {
    throw new GoogleDriveError(
      'Unable to create Google folder',
      {
        requestBody,
      },
      error
    )
  }
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.