MigrateException.php 1.6 KB

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