kantholtz / norne

A storytelling engine
MIT License
0 stars 0 forks source link

Make util.exc work with norne.obj.define().uses #3

Closed kantholtz closed 10 years ago

kantholtz commented 10 years ago

Currently, to raise a module specific exception, a work-around like this is used heavily:

var my_exc = _(norne.exc.raise).partial('my_module_name');

This is not acceptable since most of the time it is the only reason to encapsulate the whole module into an iife and also a bit hacky. It would be nice to make util.exc work like util.evt:

define('my_module').uses('util.exc').as({
  doSomething: function () {
    this.raise('my message to describe the problem');
  }
});

Dependencies: util.obj must remember the objects name.