Skip to content

Commit

Permalink
chore: use FuelError instead of JS Error (#3329)
Browse files Browse the repository at this point in the history
* use fuel error instead of common error

* add changeset
  • Loading branch information
Torres-ssf authored Oct 14, 2024
1 parent bdfd009 commit 4ae041e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/ten-dryers-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-ts/address": patch
---

chore: use `FuelError` instead of JS `Error`
5 changes: 4 additions & 1 deletion packages/address/src/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ export default class Address extends AbstractAddress {
/** @hidden */
private static toChecksum(address: string) {
if (!isB256(address)) {
throw new Error('Invalid B256 Address');
throw new FuelError(
FuelError.CODES.INVALID_B256_ADDRESS,
`Invalid B256 Address: ${address}.`
);
}

const addressHex = hexlify(address).toLowerCase().slice(2);
Expand Down

0 comments on commit 4ae041e

Please sign in to comment.