I'd like to have an attribute throw an error if it's not defined, as in this question. Each of the answers to that question suggest using Python's @property
decorator to raise an exception if the field isn't defined. How can I do that in JS?
EDIT:
I'm hoping for the equivalent of:
var MyObj = {
method: function(){
throw new Error('This method is not implemented');
}
};
...but closer to:
var MyObj = {
attribute: throw new Error('This attribute is not defined');
};