Skip to content

Commit

Permalink
Fixed an error with the exception classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanRL committed Jun 26, 2021
1 parent e1de63d commit 0efcd48
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/Samsara/Exceptions/Base/SystemError.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ public function __construct($message = "", $code = 0, Exception $previous = null
parent::__construct($message, $code, $previous);
}

public function __toString()
{
return get_class($this).': "'.$this->message.'" in '.$this->file.' (Line: '.$this->line.')\n'.$this->getTraceAsString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

namespace Samsara\Exceptions\SystemError\LogicalError;

use Exception;
use Samsara\Exceptions\Base\SystemError;

class IncompatibleObjectState extends SystemError
{

public function __construct($constraint, $suggestedSolution, $message = "", $code = 0, Exception $previous = null)
{
$message = 'Message: '.$message.' | Constraint: '.$constraint.' | Suggestion: '.$suggestedSolution;

parent::__construct($message, $code, $previous);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

namespace Samsara\Exceptions\SystemError\PlatformError;

use Exception;
use Samsara\Exceptions\Base\SystemError;

class MissingPackage extends SystemError
{

public function __construct($constraint, $suggestedSolution, $message = "", $code = 0, Exception $previous = null)
{
$message = 'Message: '.$message.' | Constraint: '.$constraint.' | Suggestion: '.$suggestedSolution;

parent::__construct($message, $code, $previous);
}

}
4 changes: 2 additions & 2 deletions src/Samsara/Exceptions/UsageError/OptionalExit.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
class OptionalExit extends UsageError
{

public function __construct($reason, $message = "", $code = 0, Exception $previous = null)
public function __construct($constraint, $suggestedSolution, $message = "", $code = 0, Exception $previous = null)
{
$message = 'Message: '.$message.' | Reason: '.$reason;
$message = 'Message: '.$message.' | Constraint: '.$constraint.' | Suggestion: '.$suggestedSolution;

parent::__construct($message, $code, $previous);
}
Expand Down

0 comments on commit 0efcd48

Please sign in to comment.