cognitedata/cognite-sdk-js

Better error message on missing parameter to loginWithApiKey

Closed this issue · 2 comments

When doing:

client.loginWithApiKey({
  project: process.env.PROJECT,
  apiKey: process.env.APIKEY,
});

and one of PROJECT or APIKEY is undefined it will throw but not telling you which one was undefined. It would also be cool if you do this:

client.loginWithApiKey({
  project: process.env.PROJECT,
});

it will tell you that options.apiKey was missing in loginWithApiKey and if you do this:

client.loginWithApiKey({
  project: process.env.PROJECT,
  apiKey: undefined,
});

it will tell you that options.apiKey was defined but it's value is undefined in loginWithApiKey