Forum OpenACS Q&A: Throwing Error When Reloaded File Fails

Request notifications

I had a devil of a time debugging yesterday because I kept making errors in my library file /foo/tcl/foo-procs.tcl that would cause it to fail on reload.

Unfortunatly the APM doesn't notice when that happens and will merrily serve the page with the old version of the foo-procs.tcl  which is never what you want.

I tried to edit apm_source so that it didn't do the source inside a catch loop but  that error was still caught.

1 question and 1 proposal:

Question: How can I make that proc throw an error that will actually stop execution of my page.

Proposal: We make that the standard behaviour of the system.

Collapse
Posted by Jade Rubick on
Great idea. Just need someone to implement it, and a TIP! :-)
Collapse
Posted by Randy O'Meara on
I think artificially breaking the existing loaded file would be a mistake. What if you're working on a core service that *must* execute in order to view any (and all) page? You've just broken the entire site! You can't use the UI to troubleshoot or adjust settings...bad idea.

An alternative to breaking the package would be to flag the package file's reload status on the APM's watch/status page. Maybe even catch and display the result of the reload (error messages) on an APM page.

Maybe a red X icon next to the package/file that, when clicked, would display the error report?

Collapse
Posted by Malte Sussdorff on
I like Randy's idea of a red X icon. Clicking on the red X icon shall send you to a page where you can see the output of the reload.
Collapse
Posted by Tilmann Singer on
When reloading a watched file fails the apm reports that in the error log, so if you are tail'ing the log you should be able to notice it.

I agree with Randy that an error in a reloaded file shouldn't be able to bring down the entire site. A visual indication of a failure would be nice, but to be honest for my personal use it's sufficient to know that the error log needs to be inspected when reloading didn't bring the desired results.

Collapse
Posted by Carl Coryell-Martin on
I disagree.  Errors that cause library files to fail to load are serious problems and I think we want to make it easy for developers to find them, and throwing the error to the page they tried to load is the fastest way to communicate the error.  You just made the change that created the error, now will be the easiest time to fix it.

You are unlikely to be able to fix the error in the UI since you created it by breaking a file.  The reload changed files is a developer feature and should not be used on production sites.

I will file a TIP for this.

best,

Carl