public static StorageExtendedErrorInformation getExtendedErrorInformation(final Reader reader,
            final TablePayloadFormat format) throws JsonParseException, IOException {

        JsonFactory jsonFactory = new JsonFactory();
        JsonParser parser = jsonFactory.createParser(reader);
        try {
            final StorageExtendedErrorInformation errorInfo = new StorageExtendedErrorInformation();

            if (!parser.hasCurrentToken()) {
                parser.nextToken();
            }

            JsonUtilities.assertIsStartObjectJsonToken(parser);

            parser.nextToken();
            JsonUtilities.assertIsFieldNameJsonToken(parser);
            JsonUtilities.assertIsExpectedFieldName(parser, "odata.error");

            // start getting extended error information
            parser.nextToken();
            JsonUtilities.assertIsStartObjectJsonToken(parser);

            // get code
            parser.nextValue();
            JsonUtilities.assertIsExpectedFieldName(parser, TableConstants.ErrorConstants.ERROR_CODE);
            errorInfo.setErrorCode(parser.getValueAsString());

            // get message
            parser.nextToken();
            JsonUtilities.assertIsFieldNameJsonToken(parser);
            JsonUtilities.assertIsExpectedFieldName(parser, TableConstants.ErrorConstants.ERROR_MESSAGE);

            parser.nextToken();
            JsonUtilities.assertIsStartObjectJsonToken(parser);

            parser.nextValue();
            JsonUtilities.assertIsExpectedFieldName(parser, "lang");

            parser.nextValue();
            JsonUtilities.assertIsExpectedFieldName(parser, "value");
            errorInfo.setErrorMessage(parser.getValueAsString());

            parser.nextToken();
            JsonUtilities.assertIsEndObjectJsonToken(parser);

            parser.nextToken();

            // get innererror if it exists
            if (parser.getCurrentToken() == JsonToken.FIELD_NAME) {
                JsonUtilities.assertIsExpectedFieldName(parser, TableConstants.ErrorConstants.INNER_ERROR);
                errorInfo.getAdditionalDetails().putAll(parseJsonErrorException(parser));
                parser.nextToken();
            }

            // end code object
            JsonUtilities.assertIsEndObjectJsonToken(parser);

            // end odata.error object
            parser.nextToken();
            JsonUtilities.assertIsEndObjectJsonToken(parser);

            return errorInfo;
        }
        finally {
            parser.close();
        }
    }
public static StorageExtendedErrorInformation getExtendedErrorInformation(final Reader reader,
            final TablePayloadFormat format) throws JsonParseException, IOException {

        JsonFactory jsonFactory = new JsonFactory();
        JsonParser parser = jsonFactory.createParser(reader);
        try {
            final StorageExtendedErrorInformation errorInfo = new StorageExtendedErrorInformation();

            if (!parser.hasCurrentToken()) {
                parser.nextToken();
            }

            JsonUtilities.assertIsStartObjectJsonToken(parser);

            parser.nextToken();
            JsonUtilities.assertIsFieldNameJsonToken(parser);
            JsonUtilities.assertIsExpectedFieldName(parser, "odata.error");

            
            parser.nextToken();
            JsonUtilities.assertIsStartObjectJsonToken(parser);

            
            parser.nextValue();
            JsonUtilities.assertIsExpectedFieldName(parser, TableConstants.ErrorConstants.ERROR_CODE);
            errorInfo.setErrorCode(parser.getValueAsString());

            
            parser.nextToken();
            JsonUtilities.assertIsFieldNameJsonToken(parser);
            JsonUtilities.assertIsExpectedFieldName(parser, TableConstants.ErrorConstants.ERROR_MESSAGE);

            parser.nextToken();
            JsonUtilities.assertIsStartObjectJsonToken(parser);

            parser.nextValue();
            JsonUtilities.assertIsExpectedFieldName(parser, "lang");

            parser.nextValue();
            JsonUtilities.assertIsExpectedFieldName(parser, "value");
            errorInfo.setErrorMessage(parser.getValueAsString());

            parser.nextToken();
            JsonUtilities.assertIsEndObjectJsonToken(parser);

            parser.nextToken();

            
            if (parser.getCurrentToken() == JsonToken.FIELD_NAME) {
                JsonUtilities.assertIsExpectedFieldName(parser, TableConstants.ErrorConstants.INNER_ERROR);
                errorInfo.getAdditionalDetails().putAll(parseJsonErrorException(parser));
                parser.nextToken();
            }

            
            JsonUtilities.assertIsEndObjectJsonToken(parser);

            
            parser.nextToken();
            JsonUtilities.assertIsEndObjectJsonToken(parser);

            return errorInfo;
        }
        finally {
            parser.close();
        }
    }
public static StorageExtendedErrorInformation getExtendedErrorInformation ( final Reader reader , final TablePayloadFormat format ) throws JsonParseException , IOException { JsonFactory jsonFactory = new JsonFactory ( ) ; JsonParser parser = jsonFactory . createParser ( reader ) ; try { final StorageExtendedErrorInformation errorInfo = new StorageExtendedErrorInformation ( ) ; if ( ! parser . hasCurrentToken ( ) ) { parser . nextToken ( ) ; } JsonUtilities . assertIsStartObjectJsonToken ( parser ) ; parser . nextToken ( ) ; JsonUtilities . assertIsFieldNameJsonToken ( parser ) ; JsonUtilities . assertIsExpectedFieldName ( parser , "odata.error" ) ; // start getting extended error information parser . nextToken ( ) ; JsonUtilities . assertIsStartObjectJsonToken ( parser ) ; // get code parser . nextValue ( ) ; JsonUtilities . assertIsExpectedFieldName ( parser , TableConstants . ErrorConstants . ERROR_CODE ) ; errorInfo . setErrorCode ( parser . getValueAsString ( ) ) ; // get message parser . nextToken ( ) ; JsonUtilities . assertIsFieldNameJsonToken ( parser ) ; JsonUtilities . assertIsExpectedFieldName ( parser , TableConstants . ErrorConstants . ERROR_MESSAGE ) ; parser . nextToken ( ) ; JsonUtilities . assertIsStartObjectJsonToken ( parser ) ; parser . nextValue ( ) ; JsonUtilities . assertIsExpectedFieldName ( parser , "lang" ) ; parser . nextValue ( ) ; JsonUtilities . assertIsExpectedFieldName ( parser , "value" ) ; errorInfo . setErrorMessage ( parser . getValueAsString ( ) ) ; parser . nextToken ( ) ; JsonUtilities . assertIsEndObjectJsonToken ( parser ) ; parser . nextToken ( ) ; // get innererror if it exists if ( parser . getCurrentToken ( ) == JsonToken . FIELD_NAME ) { JsonUtilities . assertIsExpectedFieldName ( parser , TableConstants . ErrorConstants . INNER_ERROR ) ; errorInfo . getAdditionalDetails ( ) . putAll ( parseJsonErrorException ( parser ) ) ; parser . nextToken ( ) ; } // end code object JsonUtilities . assertIsEndObjectJsonToken ( parser ) ; // end odata.error object parser . nextToken ( ) ; JsonUtilities . assertIsEndObjectJsonToken ( parser ) ; return errorInfo ; } finally { parser . close ( ) ; } }
Gets the Extended Error information.

@return the Extended Error information.

@param reader
the input stream to read error details from.
@param format
The {@link TablePayloadFormat} to use for parsing
@throws IOException
if an error occurs while accessing the stream with Json.
Gets the Extended Error information .