diff options
author | Marc Laukien <marc@zeroc.com> | 2002-11-25 20:37:13 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-11-25 20:37:13 +0000 |
commit | 2d2488c417b7543402b239deffb724bdc5035b3c (patch) | |
tree | 559c071f5f91b6e1f78e89804a2bb907d7b7930f /cpp/src | |
parent | file OutgoingAsyncF.h was initially added on branch ami. (diff) | |
download | ice-2d2488c417b7543402b239deffb724bdc5035b3c.tar.bz2 ice-2d2488c417b7543402b239deffb724bdc5035b3c.tar.xz ice-2d2488c417b7543402b239deffb724bdc5035b3c.zip |
more detail for CompressionException
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/Connection.cpp | 69 | ||||
-rw-r--r-- | cpp/src/Ice/Exception.cpp | 4 |
2 files changed, 71 insertions, 2 deletions
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp index cafa24581b3..640dcbef0c0 100644 --- a/cpp/src/Ice/Connection.cpp +++ b/cpp/src/Ice/Connection.cpp @@ -1080,6 +1080,67 @@ IceInternal::Connection::unregisterWithPool() } } +static string +getBZ2Error(int bzError) +{ + if(bzError == BZ_RUN_OK) + { + return ": BZ_RUN_OK"; + } + else if(bzError == BZ_FLUSH_OK) + { + return ": BZ_FLUSH_OK"; + } + else if(bzError == BZ_FINISH_OK) + { + return ": BZ_FINISH_OK"; + } + else if(bzError == BZ_STREAM_END) + { + return ": BZ_STREAM_END"; + } + else if(bzError == BZ_CONFIG_ERROR) + { + return ": BZ_CONFIG_ERROR"; + } + else if(bzError == BZ_SEQUENCE_ERROR) + { + return ": BZ_SEQUENCE_ERROR"; + } + else if(bzError == BZ_PARAM_ERROR) + { + return ": BZ_PARAM_ERROR"; + } + else if(bzError == BZ_MEM_ERROR) + { + return ": BZ_MEM_ERROR"; + } + else if(bzError == BZ_DATA_ERROR) + { + return ": BZ_DATA_ERROR"; + } + else if(bzError == BZ_DATA_ERROR_MAGIC) + { + return ": BZ_DATA_ERROR_MAGIC"; + } + else if(bzError == BZ_IO_ERROR) + { + return ": BZ_IO_ERROR"; + } + else if(bzError == BZ_UNEXPECTED_EOF) + { + return ": BZ_UNEXPECTED_EOF"; + } + else if(bzError == BZ_OUTBUFF_FULL) + { + return ": BZ_OUTBUFF_FULL"; + } + else + { + return ""; + } +} + void IceInternal::Connection::compress(BasicStream& uncompressed, BasicStream& compressed) { @@ -1096,7 +1157,9 @@ IceInternal::Connection::compress(BasicStream& uncompressed, BasicStream& compre 1, 0, 0); if(bzError != BZ_OK) { - throw CompressionException(__FILE__, __LINE__); + CompressionException ex(__FILE__, __LINE__); + ex.reason = "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError); + throw ex; } compressed.b.resize(headerSize + sizeof(Int) + compressedLen); @@ -1144,7 +1207,9 @@ IceInternal::Connection::uncompress(BasicStream& compressed, BasicStream& uncomp 0, 0); if(bzError != BZ_OK) { - throw CompressionException(__FILE__, __LINE__); + CompressionException ex(__FILE__, __LINE__); + ex.reason = "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError); + throw ex; } copy(compressed.b.begin(), compressed.b.begin() + headerSize, uncompressed.b.begin()); diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index 0f578d38a05..d31c97e6718 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -338,6 +338,10 @@ Ice::CompressionException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nprotocol error: failed to compress or uncompress data"; + if(!reason.empty()) + { + out << ":\n" << reason; + } } void |