It's not that your existing try/catch blocks are not catching the new error. It's the you don't have a try/catch block around the code that is causing the new error. Something in your code is making as assumption that is no longer valid when running outside of the project environment.
I would suggest reading
this[
^] and, as another example of the technique,
this[
^].