SilverStripe\Omnipay\Helper\ErrorHandling::safeguard
Safeguard a method by catching exceptions/errors that might be thrown and redirect them to the log
Signature
public function safeguard(Closure
$method,
string
$errorMessage )
Parameters
$method
—
\Closure
$errorMessage
—
string
- custom message to write to the log
Returns
- mixed
- whatever your closure returns
Errors/Exceptions
-
Exception
- any exception that occurred (only in dev and test environments)