Files
Atomcms-edit/app/Exceptions/MigrationFailedException.php
2026-05-09 17:32:17 +02:00

34 lines
746 B
PHP
Executable File

<?php
namespace App\Exceptions;
use Exception;
use Throwable;
class MigrationFailedException extends Exception
{
/**
* MigrationFailedException constructor.
*/
public function __construct(string $message = 'Migration failed', int $code = 0, ?Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
/**
* Get the exception message with additional context
*/
public function getDetailedMessage(): string
{
return 'Migration failed: ' . $this->getMessage() . ' (Code: ' . $this->getCode() . ')';
}
/**
* Get the exception code with default
*/
public function getErrorCode(): int
{
return $this->getCode() ?: 500;
}
}