X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Fthird_party%2FPluma%2FHost.cpp;h=6fb5539b89dea0555c7a9988f46e7e4c74555f33;hb=45c0f8d631a76ca7af8452c99ed90f18b432f92a;hp=eb37c33195eb45e98613d3fb9963f39b4ee3fe86;hpb=8c23766af88a29c3e830299dffc4b95d9fe61df9;p=cpPlugins.git diff --git a/lib/third_party/Pluma/Host.cpp b/lib/third_party/Pluma/Host.cpp index eb37c33..6fb5539 100644 --- a/lib/third_party/Pluma/Host.cpp +++ b/lib/third_party/Pluma/Host.cpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// #include #include +#include namespace pluma{ @@ -41,7 +42,8 @@ Host::Host(){ //////////////////////////////////////////////////////////// bool Host::add(Provider* provider){ if (provider == NULL){ - fprintf(stderr, "Trying to add a null provider.\n"); + //fprintf(stderr, "Trying to add a null provider.\n"); + throw std::runtime_error( "Trying to add a null provider." ); return false; } if (!validateProvider(provider)){ @@ -122,11 +124,19 @@ const std::list* Host::getProviders(const std::string& type) const{ bool Host::validateProvider(Provider* provider) const{ const std::string& type = provider->plumaGetType(); if ( !knows(type) ){ - fprintf(stderr, "%s provider type isn't registered.\n", type.c_str()); + // fprintf(stderr, "%s provider type isn't registered.\n", type.c_str()); + throw std::runtime_error( + type + std::string( " provider type isn't registered." ) + ); return false; } if (!provider->isCompatible(*this)){ - fprintf(stderr, "Incompatible %s provider version.\n", type.c_str()); + // fprintf(stderr, "Incompatible %s provider version.\n", type.c_str()); + throw std::runtime_error( + std::string( "Incompatible " ) + + type + + std::string( " provider version." ) + ); return false; } return true;