parent
f591f7f2fd
commit
3081d9b2fe
@ -0,0 +1,23 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Exceptions; |
||||
|
||||
/** |
||||
* Class Exception. |
||||
* |
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Exceptions |
||||
*/ |
||||
abstract class Exception extends \Exception |
||||
{ |
||||
public function displayAsString() |
||||
{ |
||||
$pieces = [$this->getMessage()]; |
||||
|
||||
if ($this->getPrevious()) { |
||||
$pieces[] = "\t".$this->getPrevious()->getMessage(); |
||||
} |
||||
|
||||
echo implode(PHP_EOL, $pieces); |
||||
} |
||||
} |
||||
@ -0,0 +1,26 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Exceptions; |
||||
|
||||
use Throwable; |
||||
|
||||
/** |
||||
* Class ExtractException. |
||||
* |
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Exceptions |
||||
*/ |
||||
class ExtractException extends Exception |
||||
{ |
||||
/** |
||||
* ExtractException constructor. |
||||
* |
||||
* @param Throwable|null $previous |
||||
*/ |
||||
public function __construct(Throwable $previous = null) |
||||
{ |
||||
$message = 'Error while extracting data.'; |
||||
|
||||
parent::__construct($message, 0, $previous); |
||||
} |
||||
} |
||||
@ -0,0 +1,37 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Exceptions; |
||||
|
||||
use Throwable; |
||||
|
||||
/** |
||||
* Class LoadException. |
||||
* |
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Exceptions |
||||
*/ |
||||
class LoadException extends Exception |
||||
{ |
||||
/** |
||||
* @var array |
||||
*/ |
||||
private $incomingData; |
||||
|
||||
public function __construct($incomingData, Throwable $previous = null) |
||||
{ |
||||
$message = 'Error while loading transformed data.'; |
||||
$this->incomingData = $incomingData; |
||||
|
||||
parent::__construct($message, 0, $previous); |
||||
} |
||||
|
||||
public function displayAsString() |
||||
{ |
||||
$pieces = [ |
||||
parent::displayAsString(), |
||||
"\t".print_r($this->incomingData, true), |
||||
]; |
||||
|
||||
echo implode(PHP_EOL, $pieces); |
||||
} |
||||
} |
||||
@ -0,0 +1,43 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\PluginBundle\MigrationMoodle\Exceptions; |
||||
|
||||
use Throwable; |
||||
|
||||
/** |
||||
* Class TransformException. |
||||
* |
||||
* @package Chamilo\PluginBundle\MigrationMoodle\Exceptions |
||||
*/ |
||||
class TransformException extends Exception |
||||
{ |
||||
/** |
||||
* @var array |
||||
*/ |
||||
private $extractedData; |
||||
|
||||
/** |
||||
* TransformException constructor. |
||||
* |
||||
* @param array $extractedData |
||||
* @param Throwable|null $previous |
||||
*/ |
||||
public function __construct(array $extractedData, Throwable $previous = null) |
||||
{ |
||||
$message = 'Error while transforming extracted data.'; |
||||
$this->extractedData = $extractedData; |
||||
|
||||
parent::__construct($message, 0, $previous); |
||||
} |
||||
|
||||
public function displayAsString() |
||||
{ |
||||
$pieces = [ |
||||
parent::displayAsString(), |
||||
"\t".print_r($this->extractedData, true), |
||||
]; |
||||
|
||||
echo implode(PHP_EOL, $pieces); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue