Skip to content

Commit abafcad

Browse files
adrienharnayTitozzz
authored andcommitted
feat(console errors): make errors actionable (#22)
Provide link to documentation when displaying errors
1 parent 181450c commit abafcad

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/internals/utils/getNormalizedURLFromOwnProps.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22

33
const getNormalizedURLFromOwnProps = (resourceName, actionName, ownProps) => {
44
if (!ownProps) {
5-
console.error(
6-
`You seem to have forgotten to pass ownProps to a selector related to ${resourceName}.${actionName}`,
7-
);
5+
console.error(`
6+
You may have forgotten to pass ownProps to a selector related to ${resourceName}.${actionName}
7+
8+
For more information, browse the related documentation: https://github.com/Brigad/redux-rest-easy/blob/master/docs/api/createResource/selectors.md#actionrequest
9+
`);
810
return '';
911
}
1012

1113
if (!ownProps.__requestURLsByActionKey) {
12-
console.error(
13-
`You seem to have forgotten to use redux-rest-easy's connect on a Component which requested ${resourceName}.${actionName}`,
14-
);
14+
console.error(`
15+
You may have forgotten to use redux-rest-easy's connect on a Component which requested ${resourceName}.${actionName}
16+
17+
For more information, browse the related documentation: https://github.com/Brigad/redux-rest-easy/blob/master/docs/api/connect.md#connectconnectargs
18+
`);
1519
return '';
1620
}
1721

src/internals/utils/getState.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
const getState = (state) => {
44
if (!state || !state.restEasy) {
5-
console.error(
6-
'There doesn\'t seem to be a "restEasy" key in your state. In doubt, double check the docs on reducers.',
7-
);
5+
console.error(`
6+
There doesn't seem to be a "restEasy" key in your state.
7+
8+
For more information, browse the related documentation: https://github.com/Brigad/redux-rest-easy/blob/master/docs/api/reducer.md#reducer
9+
`);
810
return null;
911
}
1012

0 commit comments

Comments
 (0)