Comparing version
@@ -44,5 +44,5 @@ | ||
# Publish current version to npm and bower | ||
grunt deploy | ||
grunt publish | ||
``` | ||
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
@@ -9,0 +9,0 @@ "authors": [ |
{ | ||
"name": "divhide", | ||
"description": "Divhide javascript core components for NodeJs, Browser, Titanium, ... and everything that runs javascript.", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Oscar Brito <aetheon@gmail.com>", |
@@ -1477,3 +1477,3 @@ # [](http://divhide.com/) divhide-core | ||
## Publish current version to npm and bower | ||
grunt deploy | ||
grunt publish | ||
@@ -1480,0 +1480,0 @@ ``` |
@@ -47,2 +47,22 @@ "use strict"; | ||
* | ||
* Get the stack trace | ||
* | ||
* @return {String} | ||
* | ||
*/ | ||
Internal.getStackTrace = function(){ | ||
var error = new Error(), | ||
stackStr = Safe.string(error.stack), | ||
stack = stackStr.split('\n'); | ||
/// Remove Error message + 2 first lines of the stack trace | ||
stack.splice(0,3); | ||
return stack.join('\n'); | ||
}; | ||
/** | ||
* | ||
* @class Error Class | ||
@@ -58,5 +78,28 @@ * | ||
/// initialize the Error.message | ||
this.message = message.toString(); | ||
/// get the stack trace | ||
var stack = Internal.getStackTrace(); | ||
/// define the error message | ||
Object.defineProperty( | ||
this, | ||
"message", | ||
{ | ||
get: function(){ | ||
return this.toString(); | ||
}, | ||
configurable: false | ||
} | ||
); | ||
/// define the this.stack to return the created Error | ||
/// stack | ||
Object.defineProperty( | ||
this, | ||
'stack', { | ||
get: function() { | ||
return this.toString() + "\n" + stack; | ||
}, | ||
configurable: false | ||
}); | ||
/** | ||
@@ -63,0 +106,0 @@ * |
@@ -8,3 +8,22 @@ "use strict"; | ||
/** | ||
* | ||
* Get the stack trace | ||
* | ||
* @return {String} | ||
* | ||
*/ | ||
var getStackTrace = function(){ | ||
var error = new Error(), | ||
stackStr = Safe.string(error.stack), | ||
stack = stackStr.split('\n'); | ||
/// Remove Error message + 2 first lines of the stack trace | ||
stack.splice(0,3); | ||
return stack.join('\n'); | ||
}; | ||
/** | ||
@@ -18,6 +37,20 @@ * | ||
var _items = []; | ||
/// instance of error | ||
var items = []; | ||
/// get the stack trace | ||
var stack = getStackTrace(); | ||
/// define the this.stack to return the created Error | ||
/// stack | ||
Object.defineProperty( | ||
this, | ||
'stack', { | ||
get: function() { | ||
return this.toString() + "\n" + stack; | ||
} | ||
}); | ||
Object.defineProperty( | ||
this, | ||
"message", | ||
@@ -37,3 +70,3 @@ { | ||
get: function(){ | ||
return _.clone(_items); | ||
return _.clone(items); | ||
}, | ||
@@ -49,3 +82,3 @@ configurable: false | ||
get: function(){ | ||
return _items.length; | ||
return items.length; | ||
}, | ||
@@ -91,3 +124,3 @@ configurable: false | ||
_items.push(error); | ||
items.push(error); | ||
@@ -106,3 +139,3 @@ }); | ||
this.clear = function(){ | ||
while(_items.length) _items.pop(); | ||
while(items.length) items.pop(); | ||
}; | ||
@@ -122,7 +155,7 @@ | ||
var str = "", | ||
length = _items.length, | ||
length = items.length, | ||
separator = ", "; | ||
_.each( | ||
_items, | ||
items, | ||
function(error, index){ | ||
@@ -129,0 +162,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1610601
0.5%25090
0.8%