Skip to content

Commit

Permalink
Small improvements to error messages (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning authored and TheMcMurder committed Jan 14, 2020
1 parent 21a2a2d commit 23adab2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions spec/apis/register-application.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ describe("registerApplication", function() {
expect(() => {
singleSpa.registerApplication(app);
}).toThrowError(
`The first argument must be a non-empty string 'appName'`
`The first argument to registerApplication must be a non-empty string 'appName'`
);
expect(() => {
singleSpa.registerApplication("");
}).toThrowError(
`The first argument must be a non-empty string 'appName'`
`The first argument to registerApplication must be a non-empty string 'appName'`
);
});

Expand Down Expand Up @@ -55,7 +55,7 @@ describe("registerApplication", function() {
"no-loading-fn-will-throw-error-app",
app
);
}).toThrowError(`The activeWhen argument must be a function`);
}).toThrowError(`The activityFunction argument must be a function`);
});

it(`should throw an error when the activity Function isn't a function`, () => {
Expand All @@ -65,7 +65,7 @@ describe("registerApplication", function() {
app,
app
);
}).toThrowError(`The activeWhen argument must be a function`);
}).toThrowError(`The activityFunction argument must be a function`);
});
});

Expand Down
5 changes: 3 additions & 2 deletions src/applications/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export function registerApplication(
throw Error(
formatErrorMessage(
20,
__DEV__ && `The first argument must be a non-empty string 'appName'`
__DEV__ &&
`The first argument to registerApplication must be a non-empty string 'appName'`
)
);
if (getAppNames().indexOf(appName) !== -1)
Expand Down Expand Up @@ -88,7 +89,7 @@ export function registerApplication(
throw Error(
formatErrorMessage(
24,
__DEV__ && `The activeWhen argument must be a function`
__DEV__ && `The activityFunction argument must be a function`
)
);

Expand Down
2 changes: 1 addition & 1 deletion src/navigation/navigation-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function navigateToUrl(obj) {
formatErrorMessage(
14,
__DEV__ &&
`singleSpaNavigate must be either called with a string url, with an <a> tag as its context, or with an event whose currentTarget is an <a> tag`
`singleSpaNavigate/navigateToUrl must be either called with a string url, with an <a> tag as its context, or with an event whose currentTarget is an <a> tag`
)
);
}
Expand Down

0 comments on commit 23adab2

Please sign in to comment.