|
|
@ -15,6 +15,12 @@ function getValue (value) { |
|
|
|
return value |
|
|
|
} |
|
|
|
|
|
|
|
function captureStackTrace (e, t) { |
|
|
|
if (Error.captureStackTrace) { |
|
|
|
Error.captureStackTrace(e, t) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function tfJSON (type) { |
|
|
|
if (native.Function(type)) return type.toJSON ? type.toJSON() : getTypeName(type) |
|
|
|
if (native.Array(type)) return 'Array' |
|
|
@ -35,7 +41,7 @@ function TfTypeError (type, value, valueTypeName) { |
|
|
|
valueTypeName = valueTypeName || getValueTypeName(value) |
|
|
|
this.message = tfErrorString(type, value, valueTypeName) |
|
|
|
|
|
|
|
Error.captureStackTrace(this, TfTypeError) |
|
|
|
captureStackTrace(this, TfTypeError) |
|
|
|
this.__type = type |
|
|
|
this.__value = value |
|
|
|
this.__valueTypeName = valueTypeName |
|
|
@ -59,7 +65,7 @@ function TfPropertyTypeError (type, property, label, value, valueTypeName) { |
|
|
|
this.message = 'Unexpected property "' + property + '"' |
|
|
|
} |
|
|
|
|
|
|
|
Error.captureStackTrace(this, TfTypeError) |
|
|
|
captureStackTrace(this, TfTypeError) |
|
|
|
this.__label = label |
|
|
|
this.__property = property |
|
|
|
this.__type = type |
|
|
@ -90,7 +96,7 @@ function tfSubError (e, property, label) { |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
Error.captureStackTrace(e) |
|
|
|
captureStackTrace(e) |
|
|
|
return e |
|
|
|
} |
|
|
|
|
|
|
|