diff options
author | Jack Lloyd <[email protected]> | 2015-12-11 09:42:06 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-12-11 09:42:06 -0500 |
commit | 6b9a3a534071ef84c121c406559f8fc7ad546104 (patch) | |
tree | c11480ad1f07e443ba4e992fefcd618b532c2e93 /src/lib/compression/zlib/zlib.cpp | |
parent | 79a51627ee11f4d7f55d589751b30463d1f02a76 (diff) |
Reroot the exception hierarchy into a toplevel Exception class
As the alternatives are unfortunate for applications trying to catch
all library errors, and it seems deriving from std::runtime_error
causes problems with MSVC DLLs (GH #340)
Effectively reverts 2837e915d82e43
Diffstat (limited to 'src/lib/compression/zlib/zlib.cpp')
-rw-r--r-- | src/lib/compression/zlib/zlib.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/compression/zlib/zlib.cpp b/src/lib/compression/zlib/zlib.cpp index a6a724754..10422fff7 100644 --- a/src/lib/compression/zlib/zlib.cpp +++ b/src/lib/compression/zlib/zlib.cpp @@ -53,7 +53,7 @@ class Zlib_Compression_Stream : public Zlib_Stream int rc = deflateInit2(streamp(), level, Z_DEFLATED, wbits, 8, Z_DEFAULT_STRATEGY); if(rc != Z_OK) - throw std::runtime_error("zlib deflate initialization failed"); + throw Exception("zlib deflate initialization failed"); } ~Zlib_Compression_Stream() @@ -68,7 +68,7 @@ class Zlib_Compression_Stream : public Zlib_Stream if(rc == Z_MEM_ERROR) throw std::bad_alloc(); else if(rc != Z_OK && rc != Z_STREAM_END && rc != Z_BUF_ERROR) - throw std::runtime_error("zlib deflate error " + std::to_string(rc)); + throw Exception("zlib deflate error " + std::to_string(rc)); return (rc == Z_STREAM_END); } @@ -84,7 +84,7 @@ class Zlib_Decompression_Stream : public Zlib_Stream if(rc == Z_MEM_ERROR) throw std::bad_alloc(); else if(rc != Z_OK) - throw std::runtime_error("zlib inflate initialization failed"); + throw Exception("zlib inflate initialization failed"); } ~Zlib_Decompression_Stream() @@ -99,7 +99,7 @@ class Zlib_Decompression_Stream : public Zlib_Stream if(rc == Z_MEM_ERROR) throw std::bad_alloc(); else if(rc != Z_OK && rc != Z_STREAM_END && rc != Z_BUF_ERROR) - throw std::runtime_error("zlib inflate error " + std::to_string(rc)); + throw Exception("zlib inflate error " + std::to_string(rc)); return (rc == Z_STREAM_END); } @@ -130,7 +130,7 @@ class Gzip_Compression_Stream : public Zlib_Compression_Stream int rc = deflateSetHeader(streamp(), &m_header); if(rc != Z_OK) - throw std::runtime_error("setting gzip header failed"); + throw Exception("setting gzip header failed"); } private: |