fix: Improve error handling on env boolean parsing
This commit is contained in:
@@ -732,7 +732,13 @@ export class Environment {
|
|||||||
* @returns A boolean
|
* @returns A boolean
|
||||||
*/
|
*/
|
||||||
private toBoolean(value: string) {
|
private toBoolean(value: string) {
|
||||||
|
try {
|
||||||
return value ? !!JSON.parse(value) : false;
|
return value ? !!JSON.parse(value) : false;
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(
|
||||||
|
`"${value}" could not be parsed as a boolean, must be "true" or "false"`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user