Skip to content

Commit

Permalink
Merge pull request #96 from gnosis/bug/error-not-thrown-if-tx-not-found
Browse files Browse the repository at this point in the history
Bug: When calling getTxBySafeTxHash every status code is considered success
  • Loading branch information
mmv08 authored Feb 16, 2021
2 parents c8f0366 + 1a727cb commit 6dad6eb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/safe-apps-sdk/src/txs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ class TXs {

try {
const res = await fetch(`${this.#txServiceUrl}/transactions/${safeTxHash}`, options);
if (res.status !== 200) {
throw new Error(
"Failed to get the transaction. Either safeTxHash is incorrect or transaction hasn't been indexed by the service yet",
);
}

const json = await res.json();

return json as TxServiceModel;
Expand Down

0 comments on commit 6dad6eb

Please sign in to comment.