The fetch() method will throw an OAuthException if the returned http status code is in the 4xx or 5xx range:<?php// Querying Twitter with bad login detailstry { $oauth->fetch('https://api.twitter.com/1.1/favorites/list.json');}catch(Exception $e) { echo $e->getCode(); // 401 // Message generated by OAuth class echo $e->getMessage(); // Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect) // Message returned from Twitter echo $e->lastResponse; // {"errors":[{"message":"Could not authenticate you","code":32}]}}