diff options
author | Jack Lloyd <[email protected]> | 2015-12-19 16:09:17 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-12-19 16:09:17 -0500 |
commit | 0fae1884079518e4f6d1c049cc7f341cd96c8a65 (patch) | |
tree | 41e3a8aea10b7381c0e2cfd4ee019745215876ac /src/lib/compression/bzip2 | |
parent | b3da432772628fdb3eed9cf5dabb54eda0097d2b (diff) |
Remove all remaining uses of throwing a std:: exception directly
See GH #340 and 6b9a3a5 for background
Diffstat (limited to 'src/lib/compression/bzip2')
-rw-r--r-- | src/lib/compression/bzip2/bzip2.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/compression/bzip2/bzip2.cpp b/src/lib/compression/bzip2/bzip2.cpp index d7527bfef..09cd05919 100644 --- a/src/lib/compression/bzip2/bzip2.cpp +++ b/src/lib/compression/bzip2/bzip2.cpp @@ -42,7 +42,7 @@ class Bzip2_Compression_Stream : public Bzip2_Stream int rc = BZ2_bzCompressInit(streamp(), block_size, 0, 0); if(rc == BZ_MEM_ERROR) - throw std::bad_alloc(); + throw Exception("bzip memory allocation failure"); else if(rc != BZ_OK) throw Exception("bzip compress initialization failed"); } @@ -57,9 +57,9 @@ class Bzip2_Compression_Stream : public Bzip2_Stream int rc = BZ2_bzCompress(streamp(), flags); if(rc == BZ_MEM_ERROR) - throw std::bad_alloc(); + throw Exception("bzip memory allocation failure"); else if(rc < 0) - throw Exception("bzip compress error"); + throw Exception("bzip compress error " + std::to_string(-rc)); return (rc == BZ_STREAM_END); } @@ -73,7 +73,7 @@ class Bzip2_Decompression_Stream : public Bzip2_Stream int rc = BZ2_bzDecompressInit(streamp(), 0, 0); if(rc == BZ_MEM_ERROR) - throw std::bad_alloc(); + throw Exception("bzip memory allocation failure"); else if(rc != BZ_OK) throw Exception("bzip decompress initialization failed"); } @@ -88,9 +88,9 @@ class Bzip2_Decompression_Stream : public Bzip2_Stream int rc = BZ2_bzDecompress(streamp()); if(rc == BZ_MEM_ERROR) - throw std::bad_alloc(); + throw Exception("bzip memory allocation failure"); else if(rc != BZ_OK && rc != BZ_STREAM_END) - throw Exception("bzip decompress error"); + throw Exception("bzip decompress error " + std::to_string(-rc)); return (rc == BZ_STREAM_END); } |