diff --git a/object.js b/object.js index eefff6e..db37d99 100755 --- a/object.js +++ b/object.js @@ -274,10 +274,19 @@ BOOTSTRAP(function(){ // Error with some JS quirks fixed... // + // XXX EXPERIMENTAL module.Error = Constructor('Error', Error, { get name(){ return this.constructor.name }, + + // XXX BUG? is this an error that with this everything seems to work + // while without this instances of this work fine while instances + // of "sub-classes" do not set the .stack correctly??? + // ...is this a JS quirk or am I missing something??? + __new__: function(context, ...args){ + return Reflect.construct(module.Error.__proto__, args, this.constructor) }, + //return Reflect.construct(Error, args, this.constructor) }, }) }) @@ -286,18 +295,10 @@ BOOTSTRAP(function(){ //--------------------------------------------------------------------- // Prototype chain content access... -// Value trigger iteration stop and to carry results... -// -// NOTE: we need Constructor(..) to make this so will deffer this to the -// end... -// -// XXX should we unify this and how types.js/Array does things with -// StopTteration??? -// ...I'm not sure I like the StopIteration approach as adding a -// try/catch block and rethrowing excptions masks their origin and -// context and makes things harder when tracking down errors... BOOTSTRAP(function(){ + // Value trigger iteration stop and to carry results... + // module.STOP = Constructor('STOP', { doc: 'stop iteration.', diff --git a/package.json b/package.json index 06e8f1e..f9049ea 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-object", - "version": "5.4.14", + "version": "5.4.15", "description": "", "main": "object.js", "scripts": {