If you are going to throw then you should use the appropriate error type so that the interface user can take the correct action. Include the filename and as much details as you can. You want to help the API user as much as possible.
class MyClass{
constructor ( options ) {
if(options === undefined || options === null) {
throw new ReferenceError("MyClass constructor missing required argument `options`.", "filename.js");
} else
if(options.name === undefined) {
throw new ReferenceError("MyClass constructor missing required property `options.name`.", "filename.js");
} else
if( typeof options.name !== "string") {
throw new TypeError("Argument `options.name` should be a string.","filename.js");
} else
if( options.name === "" || options.name.trim() === ""){
throw new RangeError("Argument `options.name` has an invalid value. It requiers one or more alphaNumeric chanracters.","filename.js");
} else
if( options.name.length < 5 ){
console.warning("MyClass constructor. It is recogmended that 'options.name' has more than 5 characters");
}
... all good continue construction
}
}
This way the programmer has a choice of what to do. It may require additional client input (a mistyped form) allowing the app to try again. Or the error can be handed on to reporting interfaces that can log the more serious problems. We must always provide every opportunity to resolve the problems, and provide as much information as possible. There is nothing worse than non descriptive generic errors, the last thing someone using your API wants to do is have to go into it and find out what is going on and how to get past the error if there is a way.