private static function checkForError(array $jsonResult)
    {
        if (isset($jsonResult[ 'success' ]) && true === (bool) $jsonResult[ 'success' ]) {
            return false;
        }

        if (isset($jsonResult[ 'error' ])) {
            $error = $jsonResult[ 'error' ];
            throw new WSException(
                $error[ 'message' ],
                $error[ 'code' ]
            );
        }

        // This should never happen
        throw new WSException('Unknown error');
    }