I've offloaded all the file operations in my (increasingly rococo) content-management system into a separate module with an ad-hoc collection of other utilities. It's a nice little thing that caches and flocks, and all that, but i'd like to make it die more usefully.
At the moment i get messages along the lines of 'failed to append to /path/to/file: permission denied', or whatever. Which is fine, but it doesn't tell me much about what was going on at the time.
I'd really like the error messages to tell me which subroutine in which module was responsible for this foolish instruction. I can imagine various brute-force ways to do that, but they'd be horrible to maintain and wouldn't iterate properly.
The least-worst thing i've come up with is a sort of audit trail in which the start of every subroutine or other landmark pushes a note into a global variable (ick) recording the name of the sub and the values passed to it, if the necessary debug flag is present. Then a die_noisily() call could be used to reel off the concatenation if something goes wrong, or perhaps just the last three entries.
Is there a more elegant way to learn that i was in read_file() because get_record() was triggered by parse_template()?
Braces self for humiliating three-word answer.
btw, i know the debugger can do a lot of this, but i'd like something quick and generic for troubleshooting, and a lot of my clients have lobotomised virtual servers without command-line access.
In reply to dying() more informatively by thpfft
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |