Commit ce588cb9 authored by Axel Auweter's avatar Axel Auweter
Browse files

Fixed exception handling. Time to learn C++...

parent 1c44d4d9
......@@ -191,14 +191,14 @@ void mqttCallback(SimpleMQTTMessage *msg)
#endif
}
}
catch(TTransportException *te){
cout << "TP Exception: " << te->what() << "[" << te->getType() << "]\n";
catch(const TTransportException& te){
cout << "TP Exception: " << te.what() << "[" << te.getType() << "]\n";
}
catch(InvalidRequestException *ire){
cout << "IRE Exception: " << ire->what() << "[" << ire->why << "]\n";
catch(const InvalidRequestException& ire){
cout << "IRE Exception: " << ire.what() << "[" << ire.why << "]\n";
}
catch(NotFoundException *nfe){
cout << "NF Exception: " << nfe->what() << "\n";
catch(const NotFoundException& nfe){
cout << "NF Exception: " << nfe.what() << "\n";
}
delete msg;
......@@ -282,14 +282,17 @@ int main(void) {
cout << "Using existing sensordata column familiy.\n";
}
}
catch(TTransportException *te){
cout << "TP Exception: " << te->what() << "[" << te->getType() << "]\n";
catch(const TTransportException& te){
cout << "TP Exception: " << te.what() << "[" << te.getType() << "]\n";
exit(EXIT_FAILURE);
}
catch(InvalidRequestException *ire){
cout << "IRE Exception: " << ire->what() << "[" << ire->why << "]\n";
catch(const InvalidRequestException& ire){
cout << "IRE Exception: " << ire.what() << "[" << ire.why << "]\n";
exit(EXIT_FAILURE);
}
catch(NotFoundException *nfe){
cout << "NF Exception: " << nfe->what() << "\n";
catch(const NotFoundException& nfe){
cout << "NF Exception: " << nfe.what() << "\n";
exit(EXIT_FAILURE);
}
/* Catch SIGINT signals */
......@@ -324,8 +327,8 @@ int main(void) {
ms.stop();
}
catch (exception *e) {
cout << "Exception: " << e->what() << "\n";
catch (const exception& e) {
cout << "Exception: " << e.what() << "\n";
}
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment