How to check whether there was an error

Asked by Luc Saffre on 2013-03-28

When I run appy_pod.Renderer on a template which contains buggy instructions, then the resulting file contains the tracebacks as comments. Very well. But I also would like to notify the system administrator when such errors occur. Is it possible to configure this? If not, I'd suggest a new optional keyword argument "errorFunction" to Renderer.__init__() which would get called on each error.

Luc

Question information

Language:
English Edit question
Status:
Solved
For:
Appy Edit question
Assignee:
No assignee Edit question
Solved by:
Luc Saffre
Solved:
2013-04-13
Last query:
2013-04-13
Last reply:
2013-04-12

Hi Luc,
This could be an idea...
For this new Renderer parameter, I would name it "onError". It would get the default (string) value "dump" = dump the error within the ODT result. If you set the value "raise", it would raise the exception instead (so the document would not be generated).
And if you specify a function for this parameter "onError", the function could return either "raise" or "dump" and do whatever you want.
But if several errors are found, the onError function should only be called once... (so when catching subsequent errors, we should check if an error was already raised, by, for example, storing this info on the pod environment).
What do you think ?
If you feel comfortable with this, you could start this dev, that I would integrate afterwards...
Cheeeeers
Gaetan

Luc Saffre (luc-saffre) said : #2

OK I take this job (hoping that I find the necessary time soon)