Not a developer? Go to


Error Handling

Strictly speaking, the result returned by a callback is ignored by Movable Type, unless of course an error is returned. In which case the error returned is logged in Movable Type’s Activity Log to assist in debugging. Here is a code sample illustrating how to properly return an error:

sub my_callback {
    my ($cb, ...) = @_;
    if ( <error condition> ) {
        return $cb->error("Error message");

Another way to handle errors is to call the perl function die. If a callback dies, MT will warn the error to the activity log, but will continue processing the MT::Object operation: so other callbacks will still run, and the database operation should still occur.