Comparing version 1.1.2 to 1.1.3
@@ -52,3 +52,5 @@ var canReflect = require("can-reflect"); | ||
var valueType = canString.capitalize(typeof val); | ||
throw new Error('Type value ' + typeof val === "string" ? '"' + val + '"' : val + ' (' + valueType + ') is not of type ' + canReflect.getName(Type) + '.' ); | ||
var error = new Error('Type value ' + typeof val === "string" ? '"' + val + '"' : val + ' (' + valueType + ') is not of type ' + canReflect.getName(Type) + '.' ); | ||
error.type = 'can-type-error'; | ||
throw error; | ||
} | ||
@@ -55,0 +57,0 @@ |
{ | ||
"name": "can-type", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Type definitions", | ||
@@ -5,0 +5,0 @@ "homepage": "https://canjs.com/doc/can-type.html", |
@@ -28,1 +28,11 @@ var canReflect = require("can-reflect"); | ||
}); | ||
dev.devOnlyTest('Throws Error with ".type" value to "can-type-error"', function(assert) { | ||
var numberStrictType = type.check(Number); | ||
try { | ||
canReflect.convert('foo', numberStrictType); | ||
} catch (error) { | ||
assert.equal(error.type, 'can-type-error'); | ||
} | ||
}); |
55164
744