diff options
Diffstat (limited to 'src/DBError.php')
-rw-r--r-- | src/DBError.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/DBError.php b/src/DBError.php new file mode 100644 index 0000000..4860d2f --- /dev/null +++ b/src/DBError.php @@ -0,0 +1,31 @@ +<?php + + +namespace Micropoly; + + +use Exception; + +class DBError extends Exception +{ + private string $msg; + private string $sql; + + /** + * DBError constructor. + * @param string $msg + * @param string $sql + */ + public function __construct(string $msg, string $sql) + { + $this->msg = $msg; + $this->sql = $sql; + + parent::__construct($this->buildMessage()); + } + + private function buildMessage(): string + { + return "{$this->msg}. SQL was: {$this->sql}"; + } +}
\ No newline at end of file |