Skip to content

Commit

Permalink
revert error msg changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kanthesha committed Mar 27, 2024
1 parent 119df5f commit c876e30
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/rules/require-valid-changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import {
ChangelogFormattingError,
validateChangelog,
} from '@metamask/auto-changelog';
import {
getErrorMessage,
isErrorWithCode,
isErrorWithMessage,
} from '@metamask/utils/node';
import { getErrorMessage, isErrorWithCode } from '@metamask/utils/node';

import { buildRule } from './build-rule';
import { PackageManifestSchema, RuleName } from './types';
Expand All @@ -32,12 +28,10 @@ export default buildRule({
});
return pass();
} catch (error) {
if (
isErrorWithCode(error) &&
isErrorWithMessage(error) &&
error.code === 'ERR_INVALID_JSON_FILE'
) {
throw new Error(error.message);
if (isErrorWithCode(error) && error.code === 'ERR_INVALID_JSON_FILE') {
throw new Error(
'The package does not have a well-formed manifest. This is not the fault of the changelog, but this rule requires a valid package manifest.',
);
} else if (error instanceof ChangelogFormattingError) {
return fail([
{
Expand Down

0 comments on commit c876e30

Please sign in to comment.