comparison Core/Images/JpegWriter.cpp @ 2954:d924f9bb61cc

taking advantage of details in OrthancException
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 03 Dec 2018 14:35:34 +0100
parents 52217dc47a4e
children 4e43e67f8ecf
comparison
equal deleted inserted replaced
2953:210d5afd8f2b 2954:d924f9bb61cc
147 /* If we get here, the JPEG code has signaled an error. 147 /* If we get here, the JPEG code has signaled an error.
148 * We need to clean up the JPEG object, close the input file, and return. 148 * We need to clean up the JPEG object, close the input file, and return.
149 */ 149 */
150 jpeg_destroy_compress(&cinfo); 150 jpeg_destroy_compress(&cinfo);
151 fclose(fp); 151 fclose(fp);
152 LOG(ERROR) << "Error during JPEG encoding: " << jerr.GetMessage(); 152 throw OrthancException(ErrorCode_InternalError,
153 throw OrthancException(ErrorCode_InternalError); 153 "Error during JPEG encoding: " + jerr.GetMessage());
154 } 154 }
155 155
156 // Do not allocate data on the stack below this line! 156 // Do not allocate data on the stack below this line!
157 157
158 jpeg_create_compress(&cinfo); 158 jpeg_create_compress(&cinfo);
191 if (data != NULL) 191 if (data != NULL)
192 { 192 {
193 free(data); 193 free(data);
194 } 194 }
195 195
196 LOG(ERROR) << "Error during JPEG encoding: " << jerr.GetMessage(); 196 throw OrthancException(ErrorCode_InternalError,
197 throw OrthancException(ErrorCode_InternalError); 197 "Error during JPEG encoding: " + jerr.GetMessage());
198 } 198 }
199 199
200 // Do not allocate data on the stack below this line! 200 // Do not allocate data on the stack below this line!
201 201
202 jpeg_create_compress(&cinfo); 202 jpeg_create_compress(&cinfo);