X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http%2FException.md;h=e27b813185bbfc59de507031979b8718b61a8ec4;hb=e359e7e44da8a67342f66de9345bca9b7037cf3f;hp=4f6609eb40d2743e1564301931d97a07d9df028a;hpb=ab71b0889a1242f35d279a8641f2ff100ba2940b;p=mdref%2Fmdref diff --git a/http/Exception.md b/http/Exception.md index 4f6609e..e27b813 100644 --- a/http/Exception.md +++ b/http/Exception.md @@ -1,27 +1,29 @@ -# class http\Exception extends Exception +# interface http\Exception -The http extension's Exception. +The http extension's Exception interface. -## Constants: +Use it to catch any Exception thrown by pecl/http. -* E_UNKNOWN -* E_RUNTIME -* E_INVALID_PARAM -* E_HEADER -* E_MALFORMED_HEADERS -* E_MESSAGE -* E_MESSAGE_TYPE -* E_MESSAGE_BODY -* E_ENCODING -* E_CLIENT -* E_CLIENT_POOL -* E_CLIENT_DATASHARE -* E_SOCKET -* E_RESPONSE -* E_URL -* E_QUERYSTRING -* E_COOKIE +The individual exception classes extend their equally named native PHP extensions, if such exist, and implement this empty interface. For example the http\Exception\BadMethodCallException extends SPL's BadMethodCallException. ## Properties: None. + +## Example: + + splitMultipartBody(); + } catch (http\Exception\BadMethodCallException $e) { + // doh, no multipart message + } catch (http\Exception\BadMessageException $e) { + // failure while parsing + } catch (http\Exception $e) { + // here we used the interface to catch any http\Exception + } catch (Exception $e) { + // catch any other exception (unlikely, though) + } + ?>