diff --git a/src/api/http-error.ts b/src/api/http-error.ts index 509c1df..6e6e637 100644 --- a/src/api/http-error.ts +++ b/src/api/http-error.ts @@ -12,10 +12,17 @@ export class HttpError implements Error { return ( content === '{"message":"Testing Apikey is only allowed to ticker ending with \\"01\\""}' || - content === '{"message":"Testing apikey is not allowed"}' + content === '{"message":"Testing apikey is not allowed"}' || + content === + '{"message":"Trial request only supports ticker ending \'01\'"}' ) } + public isInvalidTokenRequest(): boolean { + const content = this.response.getContentText() + return content === '{"message":"Forbidden"}' + } + public toString(): string { return this.message } diff --git a/src/custom-functions/v2/bcode.ts b/src/custom-functions/v2/bcode.ts index 7b320dd..b91fd9a 100644 --- a/src/custom-functions/v2/bcode.ts +++ b/src/custom-functions/v2/bcode.ts @@ -95,8 +95,10 @@ export function bcode( if (e.isInvalidTestingRequest()) { throw new Error('<<テスト用のAPIキーでは取得できないデータです>>') - } else if (code === 403) { + } else if (e.isInvalidTokenRequest()) { throw new Error('<>') + } else if (code === 403) { + throw new Error('<<月間リクエスト制限に達しています>>') } else if (code === 429) { throw new Error('<>') } else if (Math.floor(code / 100) === 4) {