-
Notifications
You must be signed in to change notification settings - Fork 700
Expand file tree
/
Copy pathMigrationException.php
More file actions
60 lines (52 loc) · 1.58 KB
/
Copy pathMigrationException.php
File metadata and controls
60 lines (52 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* @link https://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license https://craftcms.github.io/license/
*/
namespace craft\errors;
use Throwable;
use yii\base\UserException;
use yii\db\Migration;
/**
* MigrationException represents an exception thrown while executing a migration.
*
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
* @since 3.0.0
*/
class MigrationException extends UserException
{
/**
* @var Migration The migration being executed
*/
public Migration $migration;
/**
* @var string|null The migration output
*/
public ?string $output = null;
/**
* Constructor.
*
* @param Migration $migration The migration being executed
* @param string|null $output The migration output
* @param string|null $message The error message
* @param int $code The error code
* @param Throwable|null $previous The previous exception
*/
public function __construct(Migration $migration, ?string $output = null, ?string $message = null, int $code = 0, ?Throwable $previous = null)
{
$this->migration = $migration;
$this->output = $output;
if ($message === null) {
$message = 'An error occurred while executing the "' . get_class($migration) . ' migration' . ($previous ? ': ' . $previous->getMessage() : '.');
}
parent::__construct($message, $code, $previous);
}
/**
* @return string the user-friendly name of this exception
*/
public function getName(): string
{
return 'Migration Error';
}
}