#2468 Cannot extend sys Errs in Javascript

SlimerDude Mon 21 Sep 2015

I've just noticed that I can't extend the system Err's in Javascript:

@Js
const class ArgNotFoundErr : ArgErr {	
    new make(Str msg) : super.make(msg) { }
}

...

throw ArgNotFoundErr("Ooops")

TypeError: Cannot find function make$. (<Unknown source>:1740)

The offending generated JS line looks like:

fan.afBeanUtils.ArgNotFoundErr.make$ = function(self,msg) {
  ...
  fan.sys.ArgErr.make$(self,msg,cause);
}

Whereas the system Errs are defined with:

// ArgErr
fan.sys.ArgErr = fan.sys.Obj.$extend(fan.sys.Err);
fan.sys.ArgErr.prototype.$ctor = function(msg, cause) { fan.sys.Err.prototype.$ctor.call(this, msg, cause); }
fan.sys.ArgErr.prototype.$typeof = function() { return fan.sys.ArgErr.$type; }
fan.sys.ArgErr.make = function(msg, cause) { return new fan.sys.ArgErr(msg, cause); }

Note the ctor is called fan.sys.ArgErr.make and not fan.sys.ArgErr.make$

...and I guess it's about here that I'm told I shouldn't be extending the system Errs anyway!

andy Tue 22 Sep 2015

Ticket promoted to #2468 and assigned to andy

Login or Signup to reply.