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
|
else
|
||||||
{
|
{
|
||||||
throw new Error(
|
throw new TypeError(
|
||||||
"Cannot override property '" + name + "' with method"
|
"Cannot override property '" + name + "' with method"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ function method_override(
|
||||||
// that of its supertype
|
// that of its supertype
|
||||||
if ( arg_len < super_method.definition.length )
|
if ( arg_len < super_method.definition.length )
|
||||||
{
|
{
|
||||||
throw new Error(
|
throw new TypeError(
|
||||||
"Declaration of " + name + " must be compatiable " +
|
"Declaration of " + name + " must be compatiable " +
|
||||||
"with that of its supertype"
|
"with that of its supertype"
|
||||||
);
|
);
|
||||||
|
|
|
@ -172,14 +172,18 @@ assert.throws( function()
|
||||||
});
|
});
|
||||||
}, Error, "Concrete methods must implement the proper number of argments" );
|
}, Error, "Concrete methods must implement the proper number of argments" );
|
||||||
|
|
||||||
assert.throws( function()
|
assert.throws(
|
||||||
{
|
function()
|
||||||
AbstractFoo.extend(
|
|
||||||
{
|
{
|
||||||
// incorrect number of arguments
|
AbstractFoo.extend(
|
||||||
method: abstractMethod(),
|
{
|
||||||
});
|
// incorrect number of arguments
|
||||||
}, Error, "Abstract methods of subtypes must implement the proper number of argments" );
|
method: abstractMethod(),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
TypeError,
|
||||||
|
"Abstract methods of subtypes must implement the proper number of argments"
|
||||||
|
);
|
||||||
|
|
||||||
assert.doesNotThrow(
|
assert.doesNotThrow(
|
||||||
function()
|
function()
|
||||||
|
@ -205,7 +209,8 @@ assert.doesNotThrow(
|
||||||
{
|
{
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, Error,
|
},
|
||||||
|
Error,
|
||||||
"Concrete methods needn't implement the proper number of arguments if " +
|
"Concrete methods needn't implement the proper number of arguments if " +
|
||||||
"no definition was provided"
|
"no definition was provided"
|
||||||
);
|
);
|
||||||
|
|
|
@ -133,5 +133,5 @@ assert.throws( function()
|
||||||
{
|
{
|
||||||
foo: function() {},
|
foo: function() {},
|
||||||
});
|
});
|
||||||
}, Error, "Cannot override property with a method" );
|
}, TypeError, "Cannot override property with a method" );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue