Skip to content

Commit

Permalink
Fix Indexer.run to correctly process HTTP status code
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosrealm committed Nov 4, 2024
1 parent 99922ee commit ff02c27
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/indexers/hosted/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ export class Indexer {

async run(): Promise<void> {
const res = await this.apiClient.POST(`/indexers/${this.config.name}/run`);
if (res.status !== 200) {
// 200 is returned if the indexer was already running, 202 is returned if the indexer was started
if (res.status !== 202 && res.status !== 200) {
const message = res.status === 400 ? await res.text() : res.statusText;
throw new Error(`Failed to run indexer: ${message}`);
}
Expand Down

0 comments on commit ff02c27

Please sign in to comment.