Skip to content

Commit

Permalink
Merge pull request #229 from ArweaveTeam/task/release-error-message
Browse files Browse the repository at this point in the history
task/release 1.15.1
  • Loading branch information
rosmcmahon authored May 4, 2024
2 parents e1955d4 + 693858d commit 7d25a16
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 19 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arweave",
"version": "1.15.0",
"version": "1.15.1",
"description": "Arweave JS client library",
"main": "./node/index.js",
"react-native": "./node/index.js",
Expand Down
11 changes: 2 additions & 9 deletions src/common/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import * as B64js from "base64-js";

class UtilsError extends Error {
constructor(...args: ConstructorParameters<typeof Error>) {
super(...args);
this.name = "UtilsError";
}
}

export type Base64UrlString = string;

export function concatBuffers(
Expand Down Expand Up @@ -69,7 +62,7 @@ export function b64UrlEncode(b64UrlString: string): string {
.replace(/\//g, "_")
.replace(/\=/g, "");
} catch (error) {
throw new UtilsError("Failed to encode string", { cause: error });
throw new Error("Failed to encode string", { cause: error });
}
}

Expand All @@ -82,6 +75,6 @@ export function b64UrlDecode(b64UrlString: string): string {
: (padding = 4 - (b64UrlString.length % 4));
return b64UrlString.concat("=".repeat(padding));
} catch (error) {
throw new UtilsError("Failed to decode string", { cause: error });
throw new Error("Failed to decode string", { cause: error });
}
}
2 changes: 0 additions & 2 deletions test/common/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe("Common Utils", function () {
} catch (error) {
expect(error).to.have.property("message");
expect(error).to.have.property("cause");
expect((error as Error).name).to.be.string("UtilsError");
expect((error as Error).message).to.be.string(testCase.message);
}
});
Expand All @@ -29,7 +28,6 @@ describe("Common Utils", function () {
} catch (error) {
expect(error).to.have.property("message");
expect(error).to.have.property("cause");
expect((error as Error).name).to.be.string("UtilsError");
expect((error as Error).message).to.be.string(testCase.message);
}
});
Expand Down
5 changes: 0 additions & 5 deletions test/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ describe("Wallets and keys", function () {

expect(walletA.e).to.equal("AQAB");

expect(walletA.n).to.match(/^[a-z0-9-_]{683}$/i);

/** extra tests that private matches public */
const sigA = await arweave.crypto.sign(
walletA,
Expand All @@ -58,9 +56,6 @@ describe("Wallets and keys", function () {
);
expect(verifyB).true;

expect(walletA.d?.length).to.equal(683);
expect(walletA.d).to.match(/^[a-z0-9-_]{683}$/i);

const addressA = await arweave.wallets.jwkToAddress(walletA);
const addressB = await arweave.wallets.jwkToAddress(walletB);

Expand Down

0 comments on commit 7d25a16

Please sign in to comment.