Permalink
Browse files

make app.raise() public

  • Loading branch information...
1 parent 308a919 commit 19fe20dadabe5be2442c8eb981c1477e96e82859 @eldargab committed Sep 8, 2012
Showing with 11 additions and 6 deletions.
  1. +7 −2 lib/app.js
  2. +4 −4 lib/box.js
View
9 lib/app.js
@@ -109,7 +109,12 @@ App.prototype.onerror = function (path, fn) {
return this
}
-App.prototype._raise = function (p, e) {
+App.prototype.raise = function (path, e) {
+ if (arguments.length == 1) {
+ e = path
+ path = '&'
+ }
+ var p = this._resolve(path)
var handler, parent = p, self = this
do {
@@ -124,7 +129,7 @@ App.prototype._raise = function (p, e) {
function raise (err) {
if (err == null) return
if (p == parent) throw err
- self._raise(parent, err)
+ self.raise(parent, err)
}
try {
View
8 lib/box.js
@@ -161,7 +161,7 @@ Execute.prototype.eval = function (cb) {
fn.call(proxy, get, function (error, val) {
if (error) {
cb(error)
- self.app._raise(self.box.path, error)
+ self.app.raise(self.box.path, error)
return
}
self.promise.val = val
@@ -170,7 +170,7 @@ Execute.prototype.eval = function (cb) {
}
} catch (e) {
cb(e)
- this.app._raise(this.box.path, e)
+ this.app.raise(this.box.path, e)
}
}
@@ -203,7 +203,7 @@ ExecuteAfter.prototype.eval = function (cb) {
fn.call(proxy, get, this.promise.val, function (error, val) {
if (error) {
cb(error)
- self.app._raise(self.box.path, error)
+ self.app.raise(self.box.path, error)
return
}
if (val !== undefined) self.promise.val = val
@@ -212,7 +212,7 @@ ExecuteAfter.prototype.eval = function (cb) {
}
} catch (e) {
cb(e)
- this.app._raise(this.box.path, e)
+ this.app.raise(this.box.path, e)
}
}

0 comments on commit 19fe20d

Please sign in to comment.