Show more detail in log on brotli errors (eustas)
This commit is contained in:
@@ -108,8 +108,12 @@ bool BrotliInflater::DecompressHelper(StringPiece in, MessageHandler* handler,
|
||||
// Decompression succeeded, write out the last chunk if needed.
|
||||
break;
|
||||
case BROTLI_RESULT_ERROR:
|
||||
// TODO(eustas): use brotli API to convert error code to string.
|
||||
#ifdef BROTLI_ERROR_CODES_LIST
|
||||
handler->Message(kError, "%s",
|
||||
BrotliErrorString(BrotliGetErrorCode(brotli_state_.get())));
|
||||
#else
|
||||
handler->Message(kError, "BROTLI_RESULT_ERROR");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
StringPiece chunk(output, sizeof(output) - available_out);
|
||||
|
||||
@@ -82,7 +82,7 @@ TEST(BrotliInflater, TestCorruptInputBrotliDecompress) {
|
||||
StringPiece compressed(kHelloBrotliCorrupt, sizeof(kHelloBrotliCorrupt));
|
||||
EXPECT_FALSE(
|
||||
BrotliInflater::Decompress(compressed, &handler, &decompress_writer));
|
||||
EXPECT_STREQ("Error: BROTLI_RESULT_ERROR", handler.messages()[0]);
|
||||
EXPECT_TRUE(HasPrefixString(handler.messages()[0], "Error: BROTLI_"));
|
||||
}
|
||||
|
||||
TEST(BrotliInflater, TestTruncatedInputBrotliDecompress) {
|
||||
|
||||
Reference in New Issue
Block a user