Return to default error handling In my plugin, I'd like to catch errors when they appear in the control panel, so I can handle them differently. However, from the front-end, I'd like to keep the default Craft-style handling of error messages.



try
{
    // Some code which might produce an error
}
catch (\Exception $e)
{
    if (craft()-&gt;request-&gt;isCpRequest()) {
        // Do something with $e-&gt;getMessage()
    } else {
        // Use default Craft error handling
    }
}


All of that is working for me, just trying to sort out how to do this part...

// Use default Craft error handling


How can I get my error handling to just go back to what Craft was doing by default? I want to make sure my errors still appear in devMode per usual.
Just re-throw the exception and pretend like nothing ever happened...

try
{
    // Some code which might produce an error
}
catch (\Exception $e)
{
    if (craft()-&gt;request-&gt;isCpRequest()) {
        // Do something with $e-&gt;getMessage()
    } else {
        // Nothing to see here...
        throw $e;
    }
}