Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\migrate;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\migrate\Plugin\MigrateIdMapInterface;
|
Chris@0
|
6 use Drupal\migrate\Plugin\MigrationInterface;
|
Chris@0
|
7
|
Chris@0
|
8 /**
|
Chris@0
|
9 * Defines the migrate exception class.
|
Chris@0
|
10 */
|
Chris@0
|
11 class MigrateException extends \Exception {
|
Chris@0
|
12
|
Chris@0
|
13 /**
|
Chris@0
|
14 * The level of the error being reported.
|
Chris@0
|
15 *
|
Chris@0
|
16 * The value is a Migration::MESSAGE_* constant.
|
Chris@0
|
17 *
|
Chris@0
|
18 * @var int
|
Chris@0
|
19 */
|
Chris@0
|
20 protected $level;
|
Chris@0
|
21
|
Chris@0
|
22 /**
|
Chris@0
|
23 * The status to record in the map table for the current item.
|
Chris@0
|
24 *
|
Chris@0
|
25 * The value is a MigrateMap::STATUS_* constant.
|
Chris@0
|
26 *
|
Chris@0
|
27 * @var int
|
Chris@0
|
28 */
|
Chris@0
|
29 protected $status;
|
Chris@0
|
30
|
Chris@0
|
31 /**
|
Chris@0
|
32 * Constructs a MigrateException object.
|
Chris@0
|
33 *
|
Chris@0
|
34 * @param string $message
|
Chris@0
|
35 * The message for the exception.
|
Chris@0
|
36 * @param int $code
|
Chris@0
|
37 * The Exception code.
|
Chris@0
|
38 * @param \Exception $previous
|
Chris@0
|
39 * The previous exception used for the exception chaining.
|
Chris@0
|
40 * @param int $level
|
Chris@0
|
41 * The level of the error, a Migration::MESSAGE_* constant.
|
Chris@0
|
42 * @param int $status
|
Chris@0
|
43 * The status of the item for the map table, a MigrateMap::STATUS_*
|
Chris@0
|
44 * constant.
|
Chris@0
|
45 */
|
Chris@0
|
46 public function __construct($message = NULL, $code = 0, \Exception $previous = NULL, $level = MigrationInterface::MESSAGE_ERROR, $status = MigrateIdMapInterface::STATUS_FAILED) {
|
Chris@0
|
47 $this->level = $level;
|
Chris@0
|
48 $this->status = $status;
|
Chris@0
|
49 parent::__construct($message);
|
Chris@0
|
50 }
|
Chris@0
|
51
|
Chris@0
|
52 /**
|
Chris@0
|
53 * Gets the level.
|
Chris@0
|
54 *
|
Chris@0
|
55 * @return int
|
Chris@0
|
56 * An integer status code. @see Migration::MESSAGE_*
|
Chris@0
|
57 */
|
Chris@0
|
58 public function getLevel() {
|
Chris@0
|
59 return $this->level;
|
Chris@0
|
60 }
|
Chris@0
|
61
|
Chris@0
|
62 /**
|
Chris@0
|
63 * Gets the status of the current item.
|
Chris@0
|
64 *
|
Chris@0
|
65 * @return int
|
Chris@0
|
66 * An integer status code. @see MigrateMap::STATUS_*
|
Chris@0
|
67 */
|
Chris@0
|
68 public function getStatus() {
|
Chris@0
|
69 return $this->status;
|
Chris@0
|
70 }
|
Chris@0
|
71
|
Chris@0
|
72 }
|