@@ -25,20 +25,6 @@ const THEMR_CONFIG = typeof Symbol !== 'undefined' ?
25
25
Symbol ( 'THEMR_CONFIG' ) :
26
26
'__REACT_CSS_THEMR_CONFIG__'
27
27
28
- /**
29
- * Add suppressReactErrorLogging = true to have no errors in the tests.
30
- *
31
- * @param {string } message error message that will be thrown
32
- * @return {void }
33
- */
34
- const logErrorMessage = message => {
35
- const error = new Error ( message )
36
- if ( process . env . NODE_ENV === 'TESTING' ) {
37
- error . suppressReactErrorLogging = true
38
- }
39
- throw error
40
- }
41
-
42
28
/**
43
29
* Themr decorator
44
30
* @param {String|Number|Symbol } componentName - Component name
@@ -108,7 +94,7 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>
108
94
if ( ! themeNamespace ) return theme
109
95
110
96
if ( themeNamespace && ! theme ) {
111
- logErrorMessage ( 'Invalid themeNamespace use in react-css-themr. ' +
97
+ throw new Error ( 'Invalid themeNamespace use in react-css-themr. ' +
112
98
'themeNamespace prop should be used only with theme prop.' )
113
99
}
114
100
@@ -222,7 +208,7 @@ function merge(original = {}, mixin = {}) {
222
208
223
209
default : {
224
210
//can't merge an object with a non-object
225
- logErrorMessage ( `You are merging object ${ key } with a non-object ${ originalValue } ` )
211
+ throw new Error ( `You are merging object ${ key } with a non-object ${ originalValue } ` )
226
212
}
227
213
}
228
214
break
@@ -239,7 +225,7 @@ function merge(original = {}, mixin = {}) {
239
225
switch ( typeof originalValue ) {
240
226
case 'object' : {
241
227
//can't merge a non-object with an object
242
- logErrorMessage ( `You are merging non-object ${ mixinValue } with an object ${ key } ` )
228
+ throw new Error ( `You are merging non-object ${ mixinValue } with an object ${ key } ` )
243
229
break
244
230
}
245
231
@@ -279,7 +265,7 @@ function merge(original = {}, mixin = {}) {
279
265
*/
280
266
function validateComposeOption ( composeTheme ) {
281
267
if ( [ COMPOSE_DEEPLY , COMPOSE_SOFTLY , DONT_COMPOSE ] . indexOf ( composeTheme ) === - 1 ) {
282
- logErrorMessage (
268
+ throw new Error (
283
269
`Invalid composeTheme option for react-css-themr. Valid composition options\
284
270
are ${ COMPOSE_DEEPLY } , ${ COMPOSE_SOFTLY } and ${ DONT_COMPOSE } . The given\
285
271
option was ${ composeTheme } `
0 commit comments