Closed razonyang closed 4 years ago
Jet doesn't support your function returning an error.
Whether you should use panic or not depends on what you want to happen: if the error means you can't continue rendering the template, use panic. Jet will recover from it and show you where the error occured, instead of rendering the template. If it's not a fatal error, you can log that something went wrong and then return a default (valid) value that will allow Jet to continue rendering your template.
Does that answer your question?
Got it, thanks!
Hi, I follow the wiki to create a custom function:
What is the proper way to handle error? Should I use
panic
?Does Jet provide a way to handle function call errors globally, so that we can define function like: