Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why not tip some runtime error? #108

Closed
qidizi opened this issue Dec 13, 2013 · 2 comments
Closed

why not tip some runtime error? #108

qidizi opened this issue Dec 13, 2013 · 2 comments

Comments

@qidizi
Copy link

qidizi commented Dec 13, 2013

write some code like that?

var s = new Function('', 'var f = function(){noFunc();};try{f.apply(this,arguments);}catch(e){console.log(f+"runtime error",e)}');
console.log(s,s())

        return new Function(c.varname, 'var func=function('+c.varname+'){' +str+ '};try{return func.apply(this,arguments);}catch(e){if (window.console && console.log)console.log(func+" runtime error:",e,"the arguments is:",arguments); else alert(func+" runtime error:"+e); return "temp runtime error!";}');
@milichev
Copy link

You can safely decorate your template function with a try-catch wrapper function.

@epoberezkin
Copy link
Collaborator

@qidizi closing the issue.
I think it is a duplicate of #56, #122, etc.
If what you want is to log error instead of throwing exception, you just need to wrap template compilation in try/catch in your code, although usually exception is better.
Please reopen if the issue is different/unanswered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants