aboutsummaryrefslogtreecommitdiff
path: root/src/DBError.php
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-02-07 09:44:59 +0100
committerLaria Carolin Chabowski <laria@laria.me>2020-02-07 09:44:59 +0100
commit2eb5a432d2229788ce2fdb09f36c6f4bebdea813 (patch)
treeab57978bdda34c82b025b897cfb6825b1fd1e654 /src/DBError.php
downloadmicropoly-2eb5a432d2229788ce2fdb09f36c6f4bebdea813.tar.gz
micropoly-2eb5a432d2229788ce2fdb09f36c6f4bebdea813.tar.bz2
micropoly-2eb5a432d2229788ce2fdb09f36c6f4bebdea813.zip
Initial commit
Diffstat (limited to 'src/DBError.php')
-rw-r--r--src/DBError.php31
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