magallanes/src/Task/Exception/ErrorException.php

32 lines
705 B
PHP
Raw Normal View History

2016-12-31 07:52:25 +01:00
<?php
2022-04-10 06:20:03 +02:00
2016-12-31 07:52:25 +01:00
/*
* This file is part of the Magallanes package.
*
* (c) Andrés Montañez <andres@andresmontanez.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
2017-01-07 05:53:57 +01:00
namespace Mage\Task\Exception;
2016-12-31 07:52:25 +01:00
/**
* The Task Failed, and it has a Custom Message
*
* @author Andrés Montañez <andresmontanez@gmail.com>
*/
2022-04-10 06:20:03 +02:00
class ErrorException extends \Exception
2016-12-31 07:52:25 +01:00
{
2022-04-10 06:20:03 +02:00
public function getTrimmedMessage(int $maxLength = 60): string
2016-12-31 07:52:25 +01:00
{
$message = $this->getMessage();
if (strlen($message) > $maxLength) {
$message = substr($message, 0, $maxLength) . '...';
}
return $message;
}
}