comparison Plugins/Engine/OrthancPlugins.cpp @ 3665:4c1d2ff7ddd0 storage-commitment

handling of errors in storage commitment plugin factory
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Feb 2020 10:42:30 +0100
parents 85acfcc15829
children 898903022836
comparison
equal deleted inserted replaced
3664:85acfcc15829 3665:4c1d2ff7ddd0
761 { 761 {
762 a[i] = sopClassUids[i].c_str(); 762 a[i] = sopClassUids[i].c_str();
763 b[i] = sopInstanceUids[i].c_str(); 763 b[i] = sopInstanceUids[i].c_str();
764 } 764 }
765 765
766 void* handler = parameters_.factory(jobId.c_str(), transactionUid.c_str(), 766 void* handler = NULL;
767 a.empty() ? NULL : &a[0], b.empty() ? NULL : &b[0], 767 OrthancPluginErrorCode error = parameters_.factory(
768 static_cast<uint32_t>(n), 768 &handler, jobId.c_str(), transactionUid.c_str(),
769 remoteAet.c_str(), calledAet.c_str()); 769 a.empty() ? NULL : &a[0], b.empty() ? NULL : &b[0], static_cast<uint32_t>(n),
770 if (handler == NULL) 770 remoteAet.c_str(), calledAet.c_str());
771 { 771
772 if (error != OrthancPluginErrorCode_Success)
773 {
774 throw OrthancException(static_cast<ErrorCode>(error));
775 }
776 else if (handler == NULL)
777 {
778 // This plugin won't handle this storage commitment request
772 return NULL; 779 return NULL;
773 } 780 }
774 else 781 else
775 { 782 {
776 return new Handler(parameters_, handler); 783 return new Handler(parameters_, handler);