diff Core/Compression/DeflateBaseCompressor.cpp @ 1582:bd1889029cbb

encoding of exceptions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 17:39:38 +0200
parents fe07f82d83d3
children b1291df2f780
line wrap: on
line diff
--- a/Core/Compression/DeflateBaseCompressor.cpp	Tue Aug 25 16:18:37 2015 +0200
+++ b/Core/Compression/DeflateBaseCompressor.cpp	Tue Aug 25 17:39:38 2015 +0200
@@ -34,6 +34,7 @@
 #include "DeflateBaseCompressor.h"
 
 #include "../OrthancException.h"
+#include "../Logging.h"
 
 #include <string.h>
 
@@ -43,7 +44,8 @@
   {
     if (level >= 10)
     {
-      throw OrthancException("Zlib compression level must be between 0 (no compression) and 9 (highest compression");
+      LOG(ERROR) << "Zlib compression level must be between 0 (no compression) and 9 (highest compression)";
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
 
     compressionLevel_ = level;
@@ -60,7 +62,8 @@
 
     if (compressedSize < sizeof(uint64_t))
     {
-      throw OrthancException("The compressed buffer is ill-formed");
+      LOG(ERROR) << "The compressed buffer is ill-formed";
+      throw OrthancException(ErrorCode_CorruptedFile);
     }
 
     uint64_t size;