Skip to content

Commit

Permalink
feat(react): improve log message if ID specifier is missing (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
clebert authored Dec 20, 2018
1 parent e380857 commit cc8be3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 2 additions & 6 deletions packages/react/src/__tests__/feature-app-loader.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,7 @@ describe('FeatureAppLoader', () => {
describe('when unmounted before loading has finished', () => {
it('logs an error', async () => {
const wrapper = shallow(
<FeatureAppLoader
manager={mockManager}
src="/test.js"
idSpecifier="testIdSpecifier"
/>
<FeatureAppLoader manager={mockManager} src="/test.js" />
);

wrapper.unmount();
Expand All @@ -290,7 +286,7 @@ describe('FeatureAppLoader', () => {

expect(spyConsoleError.mock.calls).toEqual([
[
'The feature app for the src "/test.js" and the ID specifier "testIdSpecifier" could not be rendered.',
'The feature app for the src "/test.js" could not be rendered.',
mockError
]
]);
Expand Down
14 changes: 9 additions & 5 deletions packages/react/src/feature-app-loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,15 @@ export class FeatureAppLoader extends React.PureComponent<
const src = inBrowser ? browserSrc : nodeSrc;

console.error(
`The feature app for the src ${JSON.stringify(
src
)} and the ID specifier ${JSON.stringify(
idSpecifier
)} could not be rendered.`,
idSpecifier
? `The feature app for the src ${JSON.stringify(
src
)} and the ID specifier ${JSON.stringify(
idSpecifier
)} could not be rendered.`
: `The feature app for the src ${JSON.stringify(
src
)} could not be rendered.`,
error
);
}
Expand Down

0 comments on commit cc8be3d

Please sign in to comment.