Skip to content

Commit

Permalink
Handle API response error
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Dec 18, 2024
1 parent 41b4c13 commit 21397ad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/query/external/useSEContractInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ export const useSEContractInfo = ({
`${STELLAR_EXPERT_API}/${network}/contract/${contractId}`,
);

return await response.json();
const responseJson = await response.json();

if (responseJson.error) {
throw responseJson.error;
}

return responseJson;
} catch (e: any) {
throw `Something went wrong. ${e}`;
}
Expand Down

0 comments on commit 21397ad

Please sign in to comment.