protected function getErrorCodeFromServiceException(ServiceException $exception)
    {
        $xml = @simplexml_load_string($exception->getResponse()->getBody());

        if ($xml && isset($xml->Code)) {
            return (string) $xml->Code;
        }

        return $exception->getErrorText();
    }
protected function getErrorCodeFromServiceException(ServiceException $exception)
    {
        $xml = @simplexml_load_string($exception->getResponse()->getBody());

        if ($xml && isset($xml->Code)) {
            return (string) $xml->Code;
        }

        return $exception->getErrorText();
    }
protected function getErrorCodeFromServiceException ( ServiceException $ exception ) { $ xml = @ simplexml_load_string ( $ exception -> getResponse ( ) -> getBody ( ) ) ; if ( $ xml && isset ( $ xml -> Code ) ) { return ( string ) $ xml -> Code ; } return $ exception -> getErrorText ( ) ; }
Extracts the error code from a service exception.

@param ServiceException $exception

@return string
Extracts the error code from a service exception .