]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/exceptions/IOException.php
Move database read/write to FileUtils class + additional unit tests
[github/shaarli/Shaarli.git] / application / exceptions / IOException.php
diff --git a/application/exceptions/IOException.php b/application/exceptions/IOException.php
new file mode 100644 (file)
index 0000000..b563b23
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * Exception class thrown when a filesystem access failure happens
+ */
+class IOException extends Exception
+{
+    private $path;
+
+    /**
+     * Construct a new IOException
+     *
+     * @param string $path    path to the resource that cannot be accessed
+     * @param string $message Custom exception message.
+     */
+    public function __construct($path, $message = '')
+    {
+        $this->path = $path;
+        $this->message = empty($message) ? 'Error accessing' : $message;
+        $this->message .= ' "' . $this->path .'"';
+    }
+}