Daya Bay Reactor Neutrino Experiment TWiki > TWikiOopsExceptionDotPm Daya Bay webs:
Public | 中文 | Internal | Help

Log In or Register

Package TWiki::OopsException

Exception used to raise a request to redirect to an Oops URL.

An OopsException thrown anywhere in the code will redirect the browser to a url based on the oops script. oops requires the name of an oops template file from the templates directory. This file will be expanded and the parameter values passed to the exception instantiated. The result will be shown in the browser.

Plugins may throw TWiki::OopsException. For example:

use Error;

...

throw TWiki::OopsException( 'bathplugin',
                            def => 'toestuck',
                            web => $web,
                            topic => $topic,
                            params => [ 'bigtoe', 'hot tap' ] );

On this page:

ClassMethod new ($template,...)

The remaining parameters are interpreted as key-value pairs. The following keys are used:

For an example of how to use the def parameter, see the oopsattention template.

NOTE: parameter values are automatically and unconditionally entity-encoded

ObjectMethod stringify ([$session]) -> $string

Generates a string representation for the object. if a session is passed in, and the exception specifies a def, then that def is expanded. This is to allow internal expansion of oops exceptions for example when performing bulk operations, and also for debugging.

ObjectMethod redirect ($twiki)

Generate a redirect to an 'oops' script for this exception.

If the 'keep' parameter is set in the exception, it saves parameter values into the query as well. This is needed if the query string might get lost during a passthrough, due to a POST being redirected to a GET.



Revision: r4 - 2013-10-14 - 16:02:47 - TWikiContributor

Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Daya Bay? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiOopsExceptionDotPm.