Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
Add error message to catch if Deno.emit isn't a valid function (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
shapirone authored May 18, 2022
1 parent fd641aa commit 4de3c01
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,19 @@ const createFunctionFile = async (
isImportMapPresent = false;
}

const result = await Deno.emit(fnFilePath, {
bundle: "module",
check: false,
importMapPath: isImportMapPresent ? importMapPath : undefined,
});
let result;
try {
result = await Deno.emit(fnFilePath, {
bundle: "module",
check: false,
importMapPath: isImportMapPresent ? importMapPath : undefined,
});
} catch (e) {
console.log(
"This is likely due to the newest versions of Deno no longer supporting Deno.emit(). Please downgrade your version of Deno to 1.21.3",
);
throw new Error(e);
}

// Write FN File and sourcemap file
const fnFileRelative = path.join("functions", `${fnId}.js`);
Expand Down

0 comments on commit 4de3c01

Please sign in to comment.