File tree 6 files changed +11
-9
lines changed
dev-warning-missing-data-binding
dev-warning-readonly-computed
dev-warning-readonly-window-binding
6 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,10 @@ export default function dom(
147
147
. join ( ',\n' ) }
148
148
}` ;
149
149
150
+ const debugName = `<${ generator . customElement ? generator . tag : name } >` ;
151
+
150
152
const constructorBody = deindent `
153
+ ${ options . dev && `this._debugName = '${ debugName } ';` }
151
154
${ options . dev && ! generator . customElement &&
152
155
`if ( !options || (!options.target && !options._root) ) throw new Error( "'target' is a required option" );` }
153
156
this.options = options;
@@ -160,7 +163,7 @@ export default function dom(
160
163
${ options . dev &&
161
164
Array . from ( generator . expectedProperties ) . map (
162
165
prop =>
163
- `if ( !( '${ prop } ' in this._state ) ) console.warn( "Component was created without expected data property '${ prop } '" );`
166
+ `if ( !( '${ prop } ' in this._state ) ) console.warn( "${ debugName } was created without expected data property '${ prop } '" );`
164
167
) }
165
168
${ generator . bindingGroups . length &&
166
169
`this._bindingGroups = [ ${ Array ( generator . bindingGroups . length )
@@ -290,13 +293,12 @@ export default function dom(
290
293
` ) ;
291
294
}
292
295
293
- // TODO deprecate component.teardown()
294
296
builder . addBlock ( deindent `
295
297
${ options . dev && deindent `
296
298
${ name } .prototype._checkReadOnly = function _checkReadOnly ( newState ) {
297
299
${ Array . from ( generator . readonly ) . map (
298
300
prop =>
299
- `if ( '${ prop } ' in newState && !this._updatingReadonlyProperty ) throw new Error( "Cannot set read-only property '${ prop } '" );`
301
+ `if ( '${ prop } ' in newState && !this._updatingReadonlyProperty ) throw new Error( "${ debugName } : Cannot set read-only property '${ prop } '" );`
300
302
) }
301
303
};
302
304
` }
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ export function _set(newState) {
151
151
export function _setDev ( newState ) {
152
152
if ( typeof newState !== 'object' ) {
153
153
throw new Error (
154
- 'Component .set was called without an object of data key-values to update.'
154
+ this . _debugName + ' .set was called without an object of data key-values to update.'
155
155
) ;
156
156
}
157
157
Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ export default {
2
2
dev : true ,
3
3
4
4
warnings : [
5
- `Component was created without expected data property 'value'`
5
+ `<Main$> was created without expected data property 'value'`
6
6
]
7
7
} ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ export default {
2
2
dev : true ,
3
3
4
4
warnings : [
5
- `Component was created without expected data property 'foo'` ,
6
- `Component was created without expected data property 'bar'`
5
+ `<Main$> was created without expected data property 'foo'` ,
6
+ `<Main$> was created without expected data property 'bar'`
7
7
]
8
8
} ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export default {
6
6
component . set ( { foo : 1 } ) ;
7
7
throw new Error ( 'Expected an error' ) ;
8
8
} catch ( err ) {
9
- assert . equal ( err . message , `Cannot set read-only property 'foo'` ) ;
9
+ assert . equal ( err . message , `<Main$>: Cannot set read-only property 'foo'` ) ;
10
10
}
11
11
}
12
12
} ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export default {
6
6
component . set ( { width : 99 } ) ;
7
7
throw new Error ( 'Expected an error' ) ;
8
8
} catch ( err ) {
9
- assert . equal ( err . message , `Cannot set read-only property 'width'` ) ;
9
+ assert . equal ( err . message , `<Main$>: Cannot set read-only property 'width'` ) ;
10
10
}
11
11
}
12
12
} ;
You can’t perform that action at this time.
0 commit comments