From 2405ab23a5f59e3dfcb9e8995760a4d070dcf556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Thu, 3 Jul 2014 13:58:00 +0100 Subject: [PATCH] improve error handling. --- CXX/yapi.cpp | 11 +++++++++++ CXX/yapi.hh | 2 ++ 2 files changed, 13 insertions(+) diff --git a/CXX/yapi.cpp b/CXX/yapi.cpp index fbbc1122a..142c171c6 100644 --- a/CXX/yapi.cpp +++ b/CXX/yapi.cpp @@ -626,3 +626,14 @@ YAPQuery *YAPEngine::query( char *s ) { YAPQuery *n = new YAPQuery( s ); return n; } + +YAPQuery *YAPEngine::safeQuery( char *s ) { + try + { + YAPQuery *n = new YAPQuery( s ); + return n; + } + catch (...) { + return 0; + } +} diff --git a/CXX/yapi.hh b/CXX/yapi.hh index c87a82ae6..98f398db9 100644 --- a/CXX/yapi.hh +++ b/CXX/yapi.hh @@ -576,6 +576,8 @@ public: void run( char *s) { __android_log_print(ANDROID_LOG_INFO, __FUNCTION__, "bef calling disp %s %p",s, _callback); if (_callback) _callback->run(s); } /// build a query on the engine YAPQuery *query( char *s ); + /// build a query on the engine + YAPQuery *safeQuery( char *s ); }; /*