Permalink
Browse files

put a try/catch with e.stack to provide a better debugging with a ful…

…l stack trace
  • Loading branch information...
1 parent 26579d6 commit 1ab2cb2782a6a86252527a9cee483b4f896aad47 @pure committed May 14, 2012
Showing with 49 additions and 41 deletions.
  1. +1 −0 .gitignore
  2. +24 −16 libs/pure.js
  3. +24 −25 libs/pure_min.js
View
@@ -2,3 +2,4 @@
commit.sh
js/*.html
bugs/*
+compiler.jar
View
@@ -7,7 +7,7 @@
Copyright (c) 2012 Michael Cvilic - BeeBole.com
Thanks to Rog Peppe for the functional JS jump
- revision: 2.74
+ revision: 2.75
*/
var $p, pure = $p = function(){
@@ -144,24 +144,32 @@ $p.core = function(sel, ctxt, plugins){
var strs = [ parts[ 0 ] ],
n = parts.length,
fnVal, pVal, attLine, pos;
-
- for(var i = 1; i < n; i++){
- fnVal = fns[i].call( this, ctxt );
- pVal = parts[i];
-
- // if the value is empty and attribute, remove it
- if(fnVal === ''){
- attLine = strs[ strs.length - 1 ];
- if( ( pos = attLine.search( /[^\s]+=\"?$/ ) ) > -1){
- strs[ strs.length - 1 ] = attLine.substring( 0, pos );
- pVal = pVal.substr( 1 );
+ try{
+ for(var i = 1; i < n; i++){
+ fnVal = fns[i].call( this, ctxt );
+ pVal = parts[i];
+
+ // if the value is empty and attribute, remove it
+ if(fnVal === ''){
+ attLine = strs[ strs.length - 1 ];
+ if( ( pos = attLine.search( /[^\s]+=\"?$/ ) ) > -1){
+ strs[ strs.length - 1 ] = attLine.substring( 0, pos );
+ pVal = pVal.substr( 1 );
+ }
}
- }
- strs[ strs.length ] = fnVal;
- strs[ strs.length ] = pVal;
+ strs[ strs.length ] = fnVal;
+ strs[ strs.length ] = pVal;
+ }
+ return strs.join('');
+ }catch(e){
+ if(console && console.log){
+ console.log( e.stack ?
+ e.stack :
+ e.message + ' (' + e.type + ', ' + e.arguments.join('-') + '). Use Firefox or Chromium/Chrome to get a full stack of the error. ' );
+ }
+ return '';
}
- return strs.join('');
};
}
Oops, something went wrong.

0 comments on commit 1ab2cb2

Please sign in to comment.