Skip to content

Commit

Permalink
Improve getPriorityFeeEstimate Error Handling (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xIchigo authored Aug 30, 2024
1 parent f403cf8 commit 7a47451
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/RpcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,15 @@ export class RpcClient {
}
);

if (response.data.error) {
throw new Error(`Error fetching priority fee estimate: ${JSON.stringify(response.data.error, null, 2)}`);
}

return response.data.result as GetPriorityFeeEstimateResponse;
} catch (error) {
if (axios.isAxiosError(error) && error.response) {
throw new Error(`Error fetching priority fee estimate: ${JSON.stringify(error.response.data, null, 2)}`);
}
throw new Error(`Error fetching priority fee estimate: ${error}`);
}
}
Expand Down

0 comments on commit 7a47451

Please sign in to comment.