Skip to content

Commit

Permalink
fix: Throttling error JSON objects from the API have no help property
Browse files Browse the repository at this point in the history
  • Loading branch information
kellnerd committed Mar 24, 2024
1 parent 3eae19c commit 5f4a22d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export interface ErrorResponse {
/** Error message with a description. */
error: string;
/** Usage help message with link. */
help: string;
help?: string;
}

/** Checks whether the given JSON is an error response. */
// deno-lint-ignore no-explicit-any
export function isError(json: any): json is ErrorResponse {
return json.error && json.help;
return typeof json.error === "string";
}
2 changes: 1 addition & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type {
ArtistInclude,
Collection,
CollectionWithContents,
EntityWithMbid,
EntityWithMbid,
Event,
EventInclude,
Genre,
Expand Down

0 comments on commit 5f4a22d

Please sign in to comment.