@@ -25,20 +25,6 @@ const THEMR_CONFIG = typeof Symbol !== 'undefined' ?
2525 Symbol ( 'THEMR_CONFIG' ) :
2626 '__REACT_CSS_THEMR_CONFIG__'
2727
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-
4228/**
4329 * Themr decorator
4430 * @param {String|Number|Symbol } componentName - Component name
@@ -108,7 +94,7 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>
10894 if ( ! themeNamespace ) return theme
10995
11096 if ( themeNamespace && ! theme ) {
111- logErrorMessage ( 'Invalid themeNamespace use in react-css-themr. ' +
97+ throw new Error ( 'Invalid themeNamespace use in react-css-themr. ' +
11298 'themeNamespace prop should be used only with theme prop.' )
11399 }
114100
@@ -222,7 +208,7 @@ function merge(original = {}, mixin = {}) {
222208
223209 default : {
224210 //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 } ` )
226212 }
227213 }
228214 break
@@ -239,7 +225,7 @@ function merge(original = {}, mixin = {}) {
239225 switch ( typeof originalValue ) {
240226 case 'object' : {
241227 //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 } ` )
243229 break
244230 }
245231
@@ -279,7 +265,7 @@ function merge(original = {}, mixin = {}) {
279265 */
280266function validateComposeOption ( composeTheme ) {
281267 if ( [ COMPOSE_DEEPLY , COMPOSE_SOFTLY , DONT_COMPOSE ] . indexOf ( composeTheme ) === - 1 ) {
282- logErrorMessage (
268+ throw new Error (
283269 `Invalid composeTheme option for react-css-themr. Valid composition options\
284270 are ${ COMPOSE_DEEPLY } , ${ COMPOSE_SOFTLY } and ${ DONT_COMPOSE } . The given\
285271 option was ${ composeTheme } `
0 commit comments