From fb89f88fad7a2fff1e8b18828b9a03efa828380e Mon Sep 17 00:00:00 2001 From: Akiomi Kamakura Date: Mon, 31 Jul 2023 17:24:13 +0900 Subject: [PATCH] Improve error message --- src/custom-functions/v3/bcode.ts | 8 ++++++-- src/setting.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/custom-functions/v3/bcode.ts b/src/custom-functions/v3/bcode.ts index 1f8e030..9982f97 100644 --- a/src/custom-functions/v3/bcode.ts +++ b/src/custom-functions/v3/bcode.ts @@ -29,8 +29,12 @@ export function bcode( } const setting = Setting.load() - if (!setting.token) { - throw new Error('<>') + if (setting.token === null) { + throw new Error('<>') + } + + if (setting.token === '') { + throw new Error('<>') } if (typeof intent === 'string' && intent.toUpperCase() === Setting.companyIntent) { diff --git a/src/setting.ts b/src/setting.ts index a25dea6..d62da2b 100644 --- a/src/setting.ts +++ b/src/setting.ts @@ -15,12 +15,12 @@ export class Setting { static readonly companyIntent = 'COMPANY' private constructor( - private _token: string, + private _token: string | null, private _ondemandApiEnabled: boolean, private _ondemandApiCallMode: 'default' | 'force' ) {} - public get token(): string { + public get token(): string | null { return this._token }