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

Clarify error message for missing api key #115

Merged
merged 2 commits into from
Jun 14, 2019

Conversation

gtalarico
Copy link
Contributor

@gtalarico gtalarico commented Jun 13, 2019

If you accidentally make a request with a missing api key, error message is ambiguous.

// where process.env.AIRTABLE_KEY = null (unset variable)
Airtable.configure({
  endpointUrl: 'https://api.airtable.com',
  apiKey: process.env.AIRTABLE_KEY
})
...

Results in the error:

Error: API is required to connect to Airtable

I had forgotten to set the env var, so I was scratching my head to figure out what API is required meant. I think It would be more helpful if it instead described:

Error: API Key is required to connect to Airtable

If you accidentally make a request with a missing api key, error message is ambiguous.

```javascript
// where process.env.AIRTABLE_KEY = null
Airtable.configure({
  endpointUrl: 'https://api.airtable.com',
  apiKey: process.env.AIRTABLE_KEY
})
...
``` 

Results in the error:
```
Error: API is required to connect to Airtable
```

In my case, I had forgotten to set the env var, so this throw me on a loop to figure out what `API is required` meant.
It would be more helpful if it instead described: 
```
API Key is required to connect to Airtable
```
  })
@EvanHahn EvanHahn self-requested a review June 13, 2019 21:20
Copy link
Contributor

@EvanHahn EvanHahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch—we should improve this error message.

I left a comment tweaking the contents, but once that's done, we can merge this.

lib/airtable.js Outdated Show resolved Hide resolved
`An API key is required to connect to Airtable`
Copy link
Contributor

@EvanHahn EvanHahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! This will go out in the next version of Airtable.js.

@EvanHahn EvanHahn merged commit 0e489c1 into Airtable:master Jun 14, 2019
PeterPan627 added a commit to PeterPan627/airtable.js that referenced this pull request May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants