@@ -107,7 +107,9 @@ SourceMapGenerator.prototype.addMapping =
107
107
var name = util . getArg ( aArgs , 'name' , null ) ;
108
108
109
109
if ( ! this . _skipValidation ) {
110
- this . _validateMapping ( generated , original , source , name ) ;
110
+ if ( this . _validateMapping ( generated , original , source , name ) === false ) {
111
+ return ;
112
+ }
111
113
}
112
114
113
115
if ( source != null ) {
@@ -273,11 +275,14 @@ SourceMapGenerator.prototype._validateMapping =
273
275
// specific error message to try to guide them the right way.
274
276
// For example: https://github.com/Polymer/polymer-bundler/pull/519
275
277
if ( aOriginal && typeof aOriginal . line !== 'number' && typeof aOriginal . column !== 'number' ) {
276
- throw new Error (
278
+ if ( typeof console !== 'undefined' && console . warn ) {
279
+ console . warn (
277
280
'original.line and original.column are not numbers -- you probably meant to omit ' +
278
281
'the original mapping entirely and only map the generated position. If so, pass ' +
279
282
'null for the original mapping instead of an object with empty or null values.'
280
283
) ;
284
+ }
285
+ return false ;
281
286
}
282
287
283
288
if ( aGenerated && 'line' in aGenerated && 'column' in aGenerated
@@ -295,12 +300,15 @@ SourceMapGenerator.prototype._validateMapping =
295
300
return ;
296
301
}
297
302
else {
298
- throw new Error ( 'Invalid mapping: ' + JSON . stringify ( {
299
- generated : aGenerated ,
300
- source : aSource ,
301
- original : aOriginal ,
302
- name : aName
303
- } ) ) ;
303
+ if ( typeof console !== 'undefined' && console . warn ) {
304
+ console . warn ( 'Invalid mapping: ' + JSON . stringify ( {
305
+ generated : aGenerated ,
306
+ source : aSource ,
307
+ original : aOriginal ,
308
+ name : aName
309
+ } ) ) ;
310
+ }
311
+ return false ;
304
312
}
305
313
} ;
306
314
0 commit comments