Using TypeError instead of Error for property type inconsistiencies
parent
25dc7e031e
commit
5126c71a2d
|
@ -228,7 +228,7 @@ exports.propCopy = function( props, dest, result_data )
|
|||
}
|
||||
else
|
||||
{
|
||||
throw new Error(
|
||||
throw new TypeError(
|
||||
"Cannot override property '" + name + "' with method"
|
||||
);
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ function method_override(
|
|||
// that of its supertype
|
||||
if ( arg_len < super_method.definition.length )
|
||||
{
|
||||
throw new Error(
|
||||
throw new TypeError(
|
||||
"Declaration of " + name + " must be compatiable " +
|
||||
"with that of its supertype"
|
||||
);
|
||||
|
|
|
@ -172,14 +172,18 @@ assert.throws( function()
|
|||
});
|
||||
}, Error, "Concrete methods must implement the proper number of argments" );
|
||||
|
||||
assert.throws( function()
|
||||
{
|
||||
AbstractFoo.extend(
|
||||
assert.throws(
|
||||
function()
|
||||
{
|
||||
// incorrect number of arguments
|
||||
method: abstractMethod(),
|
||||
});
|
||||
}, Error, "Abstract methods of subtypes must implement the proper number of argments" );
|
||||
AbstractFoo.extend(
|
||||
{
|
||||
// incorrect number of arguments
|
||||
method: abstractMethod(),
|
||||
});
|
||||
},
|
||||
TypeError,
|
||||
"Abstract methods of subtypes must implement the proper number of argments"
|
||||
);
|
||||
|
||||
assert.doesNotThrow(
|
||||
function()
|
||||
|
@ -205,7 +209,8 @@ assert.doesNotThrow(
|
|||
{
|
||||
},
|
||||
});
|
||||
}, Error,
|
||||
},
|
||||
Error,
|
||||
"Concrete methods needn't implement the proper number of arguments if " +
|
||||
"no definition was provided"
|
||||
);
|
||||
|
|
|
@ -133,5 +133,5 @@ assert.throws( function()
|
|||
{
|
||||
foo: function() {},
|
||||
});
|
||||
}, Error, "Cannot override property with a method" );
|
||||
}, TypeError, "Cannot override property with a method" );
|
||||
|
||||
|
|
Loading…
Reference in New Issue