Skip to content

Commit

Permalink
better handling for importing non-existent bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaskollmer committed Jan 21, 2022
1 parent 1c39d8a commit 27300f9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ const {
module.exports.importFramework = name => {
const path = name.includes('/') ? name : `/System/Library/Frameworks/${name}.framework`;
const bundle = NSBundle.bundleWithPath_(path);
bundle.load();
if (!bundle) {
throw new Error(`Unable to find bundle named '${name}'`);
}
return bundle.load();
};

const js = module.exports.js = (object, returnInputIfUnableToConvert = false) => {
Expand Down

0 comments on commit 27300f9

Please sign in to comment.