Mercurial > hg > orthanc
comparison OrthancServer/main.cpp @ 1650:9f34ebfaf2c9
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Sep 2015 16:47:05 +0200 |
parents | 8040d56cb0b3 |
children | 2e692c83e2f3 |
comparison
equal
deleted
inserted
replaced
1649:8040d56cb0b3 | 1650:9f34ebfaf2c9 |
---|---|
325 virtual void Format(HttpOutput& output, | 325 virtual void Format(HttpOutput& output, |
326 const OrthancException& exception, | 326 const OrthancException& exception, |
327 HttpMethod method, | 327 HttpMethod method, |
328 const char* uri) | 328 const char* uri) |
329 { | 329 { |
330 { | |
331 bool isPlugin = false; | |
332 | |
333 #if ORTHANC_PLUGINS_ENABLED == 1 | |
334 if (plugins_ != NULL) | |
335 { | |
336 plugins_->GetErrorDictionary().LogError(exception); | |
337 isPlugin = true; | |
338 } | |
339 #endif | |
340 | |
341 if (!isPlugin) | |
342 { | |
343 LOG(ERROR) << "Exception in the HTTP handler: " << exception.What(); | |
344 } | |
345 } | |
346 | |
330 Json::Value message = Json::objectValue; | 347 Json::Value message = Json::objectValue; |
331 ErrorCode errorCode = exception.GetErrorCode(); | 348 ErrorCode errorCode = exception.GetErrorCode(); |
332 HttpStatus httpStatus = exception.GetHttpStatus(); | 349 HttpStatus httpStatus = exception.GetHttpStatus(); |
333 | 350 |
334 { | 351 { |
336 | 353 |
337 #if ORTHANC_PLUGINS_ENABLED == 1 | 354 #if ORTHANC_PLUGINS_ENABLED == 1 |
338 if (plugins_ != NULL && | 355 if (plugins_ != NULL && |
339 plugins_->GetErrorDictionary().Format(message, httpStatus, exception)) | 356 plugins_->GetErrorDictionary().Format(message, httpStatus, exception)) |
340 { | 357 { |
341 LOG(ERROR) << "Error code " << message["PluginCode"].asInt() << " inside plugin \"" | |
342 << message["PluginName"].asString() << "\": " << message["Message"].asString(); | |
343 errorCode = ErrorCode_Plugin; | 358 errorCode = ErrorCode_Plugin; |
344 isPlugin = true; | 359 isPlugin = true; |
345 } | 360 } |
346 #endif | 361 #endif |
347 | 362 |
348 if (!isPlugin) | 363 if (!isPlugin) |
349 { | 364 { |
350 LOG(ERROR) << "Exception in the HTTP handler: " << exception.What(); | |
351 message["Message"] = exception.What(); | 365 message["Message"] = exception.What(); |
352 } | 366 } |
353 } | 367 } |
354 | 368 |
355 if (!describeErrors_) | 369 if (!describeErrors_) |