Skip to content

Commit d91d9f8

Browse files
Curtis Schlakjfmengels
authored andcommitted
Remove check of hasElmFormatPathFlag in ENOENT error.
This suggested change allows the correct error to be printed based on if the person running elm-review has specified the path to the elm-review executable or has not.
1 parent e0118d2 commit d91d9f8

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/autofix.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,24 +203,22 @@ function formatFileContent(options, file, filePath) {
203203

204204
if (result.error) {
205205
if ('code' in result.error && result.error.code === 'ENOENT') {
206-
if (hasElmFormatPathFlag) {
207-
throw new ErrorMessage.CustomError(
208-
'ELM-FORMAT NOT FOUND',
206+
throw new ErrorMessage.CustomError(
207+
'ELM-FORMAT NOT FOUND',
209208

210-
// prettier-ignore
211-
hasElmFormatPathFlag
212-
? `I could not find the executable for ${chalk.magentaBright('elm-format')} at the location you specified:
209+
// prettier-ignore
210+
hasElmFormatPathFlag
211+
? `I could not find the executable for ${chalk.magentaBright('elm-format')} at the location you specified:
213212
214213
${options.elmFormatPath}`
215-
: `I could not find the executable for ${chalk.magentaBright('elm-format')}.
214+
: `I could not find the executable for ${chalk.magentaBright('elm-format')}.
216215
217216
A few options:
218217
- Install it globally.
219218
- Add it to your project through \`npm\`.
220219
- Specify the path using ${chalk.cyan('--elm-format-path <path-to-elm-format>')}.`,
221-
options.elmJsonPath
222-
);
223-
}
220+
options.elmJsonPath
221+
);
224222
} else {
225223
throw result.error;
226224
}

0 commit comments

Comments
 (0)