Skip to content

Commit

Permalink
display flipside errors
Browse files Browse the repository at this point in the history
  • Loading branch information
0xngmi committed Jul 4, 2023
1 parent 893d00f commit 935c407
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions helpers/flipsidecrypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ export async function queryFlipside(sqlQuery: string) {
'Content-Type': 'application/json'
}
})
token[sqlQuery] = query?.data.result.queryRun.id
if(query?.data?.result?.queryRun?.id){
token[sqlQuery] = query?.data.result.queryRun.id
} else {
console.log("error query data", query?.data)
throw query?.data.error.message
}
} catch(e:any){
if(e.response.statusText === 'Payment Required'){
if(e?.response?.statusText === 'Payment Required'){
if(API_KEY_INDEX < (FLIPSIDE_API_KEYS.length-1)){
const nextIndex = FLIPSIDE_API_KEYS.findIndex(k=>k===FLIPSIDE_API_KEY) + 1
if(API_KEY_INDEX < nextIndex){
Expand Down

0 comments on commit 935c407

Please sign in to comment.