Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
0xngmi committed Jul 3, 2023
1 parent 1851950 commit 725637d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions helpers/flipsidecrypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@ export async function queryFlipside(sqlQuery: string) {
} catch(e:any){
if(e.response.statusText === 'Payment Required'){
if(API_KEY_INDEX < (FLIPSIDE_API_KEYS.length-1)){
API_KEY_INDEX++;
const nextIndex = FLIPSIDE_API_KEYS.findIndex(k=>k===FLIPSIDE_API_KEY) + 1
if(API_KEY_INDEX < nextIndex){
API_KEY_INDEX = nextIndex;
}
throw "Increasing API_KEY_INDEX";
} else {
bail(new Error(`Payment Required`))
const error = new Error(`Payment Required`)
bail(error)
throw error
}
}
console.log("make query flipside", e)
console.log("make query flipside", e.response)
throw e
}
}
Expand Down

0 comments on commit 725637d

Please sign in to comment.