fix(#962): improved error label when name is not defined while setting env var

This commit is contained in:
Anoop M D 2023-11-18 09:18:40 +05:30
parent 4abb4009e6
commit d2a99b0221
3 changed files with 45 additions and 10 deletions

49
package-lock.json generated
View File

@ -17373,10 +17373,10 @@
},
"packages/bruno-cli": {
"name": "@usebruno/cli",
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",
"dependencies": {
"@usebruno/js": "0.9.1",
"@usebruno/js": "0.9.2",
"@usebruno/lang": "0.9.0",
"axios": "^1.5.1",
"chai": "^4.3.7",
@ -17468,7 +17468,7 @@
"version": "v1.1.1",
"dependencies": {
"@aws-sdk/credential-providers": "^3.425.0",
"@usebruno/js": "0.9.1",
"@usebruno/js": "0.9.2",
"@usebruno/lang": "0.9.0",
"@usebruno/schema": "0.6.0",
"about-window": "^1.15.2",
@ -17526,6 +17526,21 @@
"node": ">= 14"
}
},
"packages/bruno-electron/node_modules/ajv": {
"version": "8.12.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz",
"integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"packages/bruno-electron/node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@ -17658,6 +17673,11 @@
"js-yaml": "bin/js-yaml.js"
}
},
"packages/bruno-electron/node_modules/json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
},
"packages/bruno-electron/node_modules/uuid": {
"version": "9.0.0",
"license": "MIT",
@ -17694,7 +17714,7 @@
},
"packages/bruno-js": {
"name": "@usebruno/js",
"version": "0.9.1",
"version": "0.9.2",
"license": "MIT",
"dependencies": {
"@usebruno/query": "0.1.0",
@ -21477,7 +21497,7 @@
"nanoid": "3.3.4",
"next": "12.3.3",
"path": "^0.12.7",
"pdfjs-dist": "3.11.174",
"pdfjs-dist": "^3.11.174",
"platform": "^1.3.6",
"posthog-node": "^2.1.0",
"prettier": "^2.7.1",
@ -21579,7 +21599,7 @@
"@usebruno/cli": {
"version": "file:packages/bruno-cli",
"requires": {
"@usebruno/js": "0.9.1",
"@usebruno/js": "0.9.2",
"@usebruno/lang": "0.9.0",
"axios": "^1.5.1",
"chai": "^4.3.7",
@ -22543,7 +22563,7 @@
"version": "file:packages/bruno-electron",
"requires": {
"@aws-sdk/credential-providers": "^3.425.0",
"@usebruno/js": "0.9.1",
"@usebruno/js": "0.9.2",
"@usebruno/lang": "0.9.0",
"@usebruno/schema": "0.6.0",
"about-window": "^1.15.2",
@ -22592,6 +22612,16 @@
"debug": "^4.3.4"
}
},
"ajv": {
"version": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz",
"integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==",
"requires": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
}
},
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@ -22675,6 +22705,11 @@
"argparse": "^2.0.1"
}
},
"json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
},
"uuid": {
"version": "9.0.0"
}

View File

@ -20,7 +20,7 @@
},
"dependencies": {
"@aws-sdk/credential-providers": "^3.425.0",
"@usebruno/js": "0.9.1",
"@usebruno/js": "0.9.2",
"@usebruno/lang": "0.9.0",
"@usebruno/schema": "0.6.0",
"about-window": "^1.15.2",

View File

@ -45,7 +45,7 @@ class Bru {
setEnvVar(key, value) {
if (!key) {
throw new Error('Key is required');
throw new Error('Creating a env variable without specifying a name is not allowed.');
}
// gracefully ignore if key is not present in environment
@ -58,7 +58,7 @@ class Bru {
setVar(key, value) {
if (!key) {
throw new Error('A variable with an empty name has been created but name is required.');
throw new Error('Creating a variable without specifying a name is not allowed.');
}
if (envVariableNameRegex.test(key) === false) {