Skip to content

Commit

Permalink
Wrapping some errors in new Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Pauan committed Sep 24, 2024
1 parent e046a58 commit 0a473a3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sdk/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ async function executeOffline(
// Ensure the program is valid and that it contains the function specified
const program = programManager.createProgramFromSource(localProgram);
if (program instanceof Error) {
throw "Error creating program from source";
throw new Error("Error creating program from source");
}
const program_id = program.id();
if (!program.hasFunction(aleoFunction)) {
throw `Program ${program_id} does not contain function ${aleoFunction}`;
throw new Error(`Program ${program_id} does not contain function ${aleoFunction}`);
}
const cacheKey = `${program_id}:${aleoFunction}`;

Expand All @@ -55,7 +55,7 @@ async function executeOffline(
);

if (imports instanceof Error) {
throw "Error getting program imports";
throw new Error("Error getting program imports");
}
// Get the proving and verifying keys for the function
if (lastLocalProgram !== localProgram) {
Expand Down Expand Up @@ -100,7 +100,7 @@ async function executeOffline(
const keys = keyProvider.getKeys(cacheKey);

if (keys instanceof Error) {
throw "Could not get verifying key";
throw new Error("Could not get verifying key");
}

const verifyingKey = keys[1];
Expand Down

0 comments on commit 0a473a3

Please sign in to comment.