I often use rails runner $PATH_TO_SCRIPT to run import scripts or other miscellaneous tasks (similar to rake tasks). But since the runner command is only running the script, the pry-rescue middleware isn't involved and no exceptions get rescued when doing rescue rails runner $PATH_TO_SCRIPT.
Workaround: passing -i flag will at least catch the exceptions, but not ideal since it pulls up the session regardless of if there was an error or not.
I often use
rails runner $PATH_TO_SCRIPT
to run import scripts or other miscellaneous tasks (similar torake
tasks). But since therunner
command is only running the script, the pry-rescue middleware isn't involved and no exceptions get rescued when doingrescue rails runner $PATH_TO_SCRIPT
.