Skip to content

Commit

Permalink
better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lganzzzo committed May 1, 2023
1 parent e731806 commit 33a831e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/oatpp-zlib/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ DeflateEncoder::DeflateEncoder(v_buff_size bufferSize, bool gzip, v_int32 compre
15 | 16,
8 /* default memory */,
Z_DEFAULT_STRATEGY);
if(res != Z_OK) {
OATPP_LOGE("[oatpp::zlib::DeflateEncoder::DeflateEncoder()]", "Error. Failed call to 'deflateInit2()'. Result %d", res)
}
} else {
res = deflateInit(&m_zStream, compressionLevel);
if(res != Z_OK) {
OATPP_LOGE("[oatpp::zlib::DeflateEncoder::DeflateEncoder()]", "Error. Failed call to 'deflateInit()'. Result %d", res)
}
}

if(res != Z_OK) {
Expand All @@ -66,7 +72,7 @@ DeflateEncoder::DeflateEncoder(v_buff_size bufferSize, bool gzip, v_int32 compre
DeflateEncoder::~DeflateEncoder() {
v_int32 res = deflateEnd(&m_zStream);
if(res != Z_OK) {
OATPP_LOGE("[oatpp::zlib::DeflateEncoder::~DeflateEncoder()]", "Error. Failed call to 'deflateEnd()'.")
OATPP_LOGE("[oatpp::zlib::DeflateEncoder::~DeflateEncoder()]", "Error. Failed call to 'deflateEnd()'. Result %d", res)
}
}

Expand Down Expand Up @@ -185,8 +191,14 @@ DeflateDecoder::DeflateDecoder(v_buff_size bufferSize, bool gzip)

if(gzip) {
res = inflateInit2(&m_zStream, 15 | 16);
if(res != Z_OK) {
OATPP_LOGE("[oatpp::zlib::DeflateDecoder::DeflateDecoder()]", "Error. Failed call to 'inflateInit2()'. Result %d", res)
}
} else {
res = inflateInit(&m_zStream);
if(res != Z_OK) {
OATPP_LOGE("[oatpp::zlib::DeflateDecoder::DeflateDecoder()]", "Error. Failed call to 'inflateInit()'. Result %d", res)
}
}

if(res != Z_OK) {
Expand All @@ -198,7 +210,7 @@ DeflateDecoder::DeflateDecoder(v_buff_size bufferSize, bool gzip)
DeflateDecoder::~DeflateDecoder() {
v_int32 res = inflateEnd(&m_zStream);
if(res != Z_OK) {
OATPP_LOGE("[oatpp::zlib::DeflateDecoder::~DeflateDecoder()]", "Error. Failed call to 'inflateEnd()'.")
OATPP_LOGE("[oatpp::zlib::DeflateDecoder::~DeflateDecoder()]", "Error. Failed call to 'inflateEnd()'. Result %d", res)
}
}

Expand Down

0 comments on commit 33a831e

Please sign in to comment.