Skip to content

Commit

Permalink
[Fix] throw a better error if no svg is found
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 28, 2018
1 parent 8376efa commit 157bbf0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.js
Expand Up @@ -57,6 +57,9 @@ export default ({ types: t }) => ({
if (caseSensitive && !fileExistsWithCaseSync(svgPath)) {
throw new Error(`File path didn't match case of file on disk: ${svgPath}`);
}
if (!svgPath) {
throw new Error(`File path does not exist: ${importPath}`);
}
const rawSource = readFileSync(svgPath, 'utf8');
const optimizedSource = state.opts.svgo === false
? rawSource
Expand Down

0 comments on commit 157bbf0

Please sign in to comment.