Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/api/http-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 3 additions & 1 deletion src/custom-functions/v2/bcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('<<APIキーが有効ではありません>>')
} else if (code === 403) {
throw new Error('<<月間リクエスト制限に達しています>>')
} else if (code === 429) {
throw new Error('<<APIの実行回数が上限に達しました>>')
} else if (Math.floor(code / 100) === 4) {
Expand Down