@@ -28,32 +28,32 @@ const getClassNameForNamespacedStyleName = (
2828
2929 if ( ! moduleName ) {
3030 if ( handleMissingStyleName === 'throw' ) {
31- throw new Error ( 'Invalid style name.' ) ;
31+ throw new Error ( 'Invalid style name: ' + styleName ) ;
3232 } else if ( handleMissingStyleName === 'warn' ) {
3333 // eslint-disable-next-line no-console
34- console . warn ( 'Invalid style name.' ) ;
34+ console . warn ( 'Invalid style name: ' + styleName ) ;
3535 } else {
3636 return null ;
3737 }
3838 }
3939
4040 if ( ! styleModuleImportMap [ importName ] ) {
4141 if ( handleMissingStyleName === 'throw' ) {
42- throw new Error ( 'CSS module import does not exist.' ) ;
42+ throw new Error ( 'CSS module import does not exist: ' + importName ) ;
4343 } else if ( handleMissingStyleName === 'warn' ) {
4444 // eslint-disable-next-line no-console
45- console . warn ( 'CSS module import does not exist.' ) ;
45+ console . warn ( 'CSS module import does not exist: ' + importName ) ;
4646 } else {
4747 return null ;
4848 }
4949 }
5050
5151 if ( ! styleModuleImportMap [ importName ] [ moduleName ] ) {
5252 if ( handleMissingStyleName === 'throw' ) {
53- throw new Error ( 'CSS module does not exist.' ) ;
53+ throw new Error ( 'CSS module does not exist: ' + moduleName ) ;
5454 } else if ( handleMissingStyleName === 'warn' ) {
5555 // eslint-disable-next-line no-console
56- console . warn ( 'CSS module does not exist.' ) ;
56+ console . warn ( 'CSS module does not exist: ' + moduleName ) ;
5757 } else {
5858 return null ;
5959 }
@@ -83,11 +83,13 @@ export default (styleNameValue: string, styleModuleImportMap: StyleModuleImportM
8383 }
8484
8585 if ( styleModuleImportMapKeys . length === 0 ) {
86- throw new Error ( 'Cannot use styleName attribute without importing at least one stylesheet.' ) ;
86+ throw new Error ( 'Cannot use styleName attribute for style name \'' + styleName +
87+ '\' without importing at least one stylesheet.' ) ;
8788 }
8889
8990 if ( styleModuleImportMapKeys . length > 1 ) {
90- throw new Error ( 'Cannot use anonymous style name with more than one stylesheet import.' ) ;
91+ throw new Error ( 'Cannot use anonymous style name \'' + styleName +
92+ '\' with more than one stylesheet import.' ) ;
9193 }
9294
9395 const styleModuleMap : StyleModuleMapType = styleModuleImportMap [ styleModuleImportMapKeys [ 0 ] ] ;
0 commit comments