Skip to content

Commit

Permalink
Merge pull request #8 from ehmicky/chore/error-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
swyxio authored Apr 30, 2020
2 parents f3c90e0 + 74aaab1 commit 6e69e00
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ function netlifyPluginSearchIndex(_) {
publishDirJSONFileName = 'searchIndex',
debugMode,
},
constants: { BUILD_DIR, FUNCTIONS_SRC, FUNCTIONS_DIST }
constants: { BUILD_DIR, FUNCTIONS_SRC, FUNCTIONS_DIST },
utils: { build }
} = opts;

if (generatedFunctionName === null && publishDirJSONFileName === null) {
throw new Error(
build.failPlugin(
'generatedFunctionName and publishDirJSONFileName cannot both be null, this plugin wouldnt be generating anything!'
);
}
Expand Down Expand Up @@ -82,7 +83,7 @@ function netlifyPluginSearchIndex(_) {
*/
if (generatedFunctionName) {
if (typeof FUNCTIONS_SRC === 'undefined') {
throw new Error('FUNCTIONS_SRC is undefined - did you forget to declare a functions folder in netlify.toml? https://github.com/sw-yx/netlify-plugin-search-index#usage')
build.failPlugin('FUNCTIONS_SRC is undefined - did you forget to declare a functions folder in netlify.toml? https://github.com/sw-yx/netlify-plugin-search-index#usage')
}
const searchIndexFunctionPath = path.join(
FUNCTIONS_SRC,
Expand Down

0 comments on commit 6e69e00

Please sign in to comment.