Exception docs
authorMichael Wallner <mike@php.net>
Thu, 25 Sep 2014 12:31:09 +0000 (14:31 +0200)
committerMichael Wallner <mike@php.net>
Thu, 25 Sep 2014 12:31:09 +0000 (14:31 +0200)
pq/Exception.md [new file with mode: 0644]
pq/Exception/BadMethodCallException.md [new file with mode: 0644]
pq/Exception/DomainException.md [new file with mode: 0644]
pq/Exception/InvalidArgumentException.md [new file with mode: 0644]
pq/Exception/RuntimeException.md [new file with mode: 0644]

diff --git a/pq/Exception.md b/pq/Exception.md
new file mode 100644 (file)
index 0000000..4bdea5b
--- /dev/null
@@ -0,0 +1,37 @@
+# interface pq\Exception
+
+A base interface for all pq\Exception classes.
+
+## Constants:
+
+* INVALID_ARGUMENT  
+  An invalid argument was passed to a method (pq\Exception\InvalidArgumentException).
+* RUNTIME  
+  A runtime exception occurred (pq\Exception\RuntimeException).
+* CONNECTION_FAILED  
+  The connection failed (pq\Exception\RuntimeException).
+* IO  
+  An input/output exception occurred (pq\Exception\RuntimeException).
+* ESCAPE  
+  Escaping an argument or identifier failed internally (pq\Exception\RuntimeException).
+* UNINITIALIZED  
+  An object's constructor was not called (pq\Exception\BadMethodCallException).
+* BAD_METHODCALL  
+  Calling this method was not expected (yet) (pq\Exception\BadMethodCallException).
+* SQL  
+  SQL syntax error (pq\Exception\DomainException).
+* DOMAIN  
+  Implementation domain error (pq\Exception\DomainException).
+  
+
+## Example:
+
+       <?php
+       
+       try {
+               $connection = new pq\Connection;
+       } catch (pq\Exception $e) {
+               printf("%s (%d)\n", $e->getMessage(), $e->getCode());
+       }
+       
+       ?>
diff --git a/pq/Exception/BadMethodCallException.md b/pq/Exception/BadMethodCallException.md
new file mode 100644 (file)
index 0000000..82f07d1
--- /dev/null
@@ -0,0 +1,8 @@
+# class pq\Exception\BadMethodCallException extends BadMethodCallException implements pq\Exception
+
+A method calls was not expected.
+
+## Codes:
+
+* pq\Exception::UNINITIALIZED
+* pq\Exception::BAD_METHODCALL
diff --git a/pq/Exception/DomainException.md b/pq/Exception/DomainException.md
new file mode 100644 (file)
index 0000000..00ddd3d
--- /dev/null
@@ -0,0 +1,13 @@
+# class pq\Exception\DomainException extends DomainException implements pq\Exception
+
+Implementation or SQL syntax error.
+
+## Codes:
+
+* pq\Exception::SQL
+* pq\Exception::DOMAIN
+
+## Properties:
+
+* public string $sqlstate  
+  The SQLSTATE code, see the [official documentation](http://www.postgresql.org/docs/current/static/errcodes-appendix.html) for further information.
diff --git a/pq/Exception/InvalidArgumentException.md b/pq/Exception/InvalidArgumentException.md
new file mode 100644 (file)
index 0000000..dd11127
--- /dev/null
@@ -0,0 +1,7 @@
+# class pq\Exception\InvalidArgumentException extends InvalidArgumentException implements pq\Exception
+
+An invalid argument was passed to a method.
+
+## Codes:
+
+ * pq\Exception::INVALID_ARGUMENT
diff --git a/pq/Exception/RuntimeException.md b/pq/Exception/RuntimeException.md
new file mode 100644 (file)
index 0000000..26d4deb
--- /dev/null
@@ -0,0 +1,10 @@
+# class pq\Exception\RuntimeException extends RuntimeException implements pq\Exception
+
+A runtime exception occurred.
+
+## Codes:
+
+* pq\Exception::RUNTIME
+* pq\Exception::CONNECTION_FAILED
+* pq\Exception::IO
+* pq\Exception::ESCAPE