2.22.5-stable+timestamp.2022.06.04.18.13.51(Running on Microsoft-IIS/10.0, Python 3.9.13)
I am trying to catch errors in web2py shell scripts which are run in batch, but some exceptions are not being passed up the call stack when running in shell mode.
My situation is as follows:
- Create the error scenario
- empty the languages/plural-en.py in the welcome application
- Run a shell script using -M -R
- can be a simple Hello World script
- Since it is a shell script, shell.py is used instead of main.py
- The exception will be triggered in gluon/languages.py in in the function read_plural_dict_aux() when executing
- return eval(lang_text) or {}
- In this scenario, the shell script will fail but give a success return code (rc=0) because the exception is not passed up the call stack
- If the welcome application is run via the browser, it uses main.py instead of shell.py and the exception is passed up the call stack and we can see the error code in the error ticket.
I have tried catching the exception from a few different places and tried custom extensions as well, but I can't catch this exception anywhere in the call stack.
The reason I am trying to solve this is that we have batch jobs that sometimes have failed but give a success return code and so I am trying to find the root cause. I think that this failure to capture the exceptions may be the cause. Does anyone have any ideas as to what could be the reason for this?
Note: If you want to see the call stack, it suffices to delete all the contents of plural-en.py and run the welcome app from the browser. In the error ticket, the call stack will basically the same as the shell version as of the call to compileapp.py
Kind Regards,
David