Changeset 54ac968 in nscp


Ignore:
Timestamp:
08/10/11 15:05:59 (22 months ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
afd42f1
Parents:
04ef932
Message:

2011-08-10

  • Fixed linus issues and defect
  • Fixed some issues in the test python script regarding how prefix is handled
  • Fixed PythonScript module to actually use the correct function map :)
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r04ef932 r54ac968  
    379379  ${Boost_PROGRAM_OPTIONS_LIBRARY} 
    380380  ${Boost_THREAD_LIBRARY} 
     381  ${Boost_SYSTEM_LIBRARY} 
    381382  ${EXTRA_LIBS} 
    382383  ${PROTOBUF_LIBRARY} 
  • changelog

    r04ef932 r54ac968  
    88 
    992011-08-10 
     10 * Fixed linus issues and defect 
     11 * Fixed some issues in the test python script regarding how prefix is handled 
     12 * Fixed PythonScript module to actually use the correct function map :) 
    1013 * Fixed so it builds and runs on linux (but parser had issues so disabled som grammar rules whichneeds to be enabled again) 
    1114 * Added a lot of freatures and cleand up the PythonScript module 
  • include/nscapi/macros.hpp

    rb7d17f8 r54ac968  
    77  extern "C" int NSModuleHelperInit(unsigned int id, nscapi::core_api::lpNSAPILoader f); \ 
    88  extern "C" int NSLoadModule(); \ 
    9   extern "C" int NSLoadModuleEx(const wchar_t alias, int mode); \ 
     9  extern "C" int NSLoadModuleEx(wchar_t* alias, int mode); \ 
    1010  extern "C" void NSDeleteBuffer(char**buffer); \ 
    1111  extern "C" int NSGetModuleName(wchar_t* buf, int buflen); \ 
  • include/nscapi/nscapi_helper.cpp

    rd66ccee r54ac968  
    226226    return _T("WARNING"); 
    227227  else 
    228     return _T("BAD_CODE"); 
     228    return _T("BAD_CODE: " + strEx::itos(returnCode)); 
    229229} 
    230230/** 
  • include/settings/client/settings_client.hpp

    rd66ccee r54ac968  
    590590                v->key->notify(core_, v->path, v->key_name); 
    591591            } 
     592          } catch (const nscapi::nscapi_exception &e) { 
     593            core_->err(__FILE__, __LINE__, _T("Failed to notify ") + v->key_name + _T(": ") + e.msg_); 
     594          } catch (const std::exception &e) { 
     595            core_->err(__FILE__, __LINE__, _T("Failed to notify ") + v->key_name + _T(": ") + utf8::cvt<std::wstring>(e.what())); 
    592596          } catch (...) { 
    593             core_->err(__FILE__, __LINE__, _T("Failed to register: ") + v->key_name); 
     597            core_->err(__FILE__, __LINE__, _T("Failed to notify: ") + v->key_name); 
    594598          } 
    595599        } 
     
    598602            if (v->path) 
    599603              v->path->notify(core_, v->path_name); 
     604          } catch (const nscapi::nscapi_exception &e) { 
     605            core_->err(__FILE__, __LINE__, _T("Failed to notify ") + v->path_name + _T(": ") + e.msg_); 
     606          } catch (const std::exception &e) { 
     607            core_->err(__FILE__, __LINE__, _T("Failed to notify ") + v->path_name + _T(": ") + utf8::cvt<std::wstring>(e.what())); 
    600608          } catch (...) { 
    601             core_->err(__FILE__, __LINE__, _T("Failed to register: ") + v->path_name); 
     609            core_->err(__FILE__, __LINE__, _T("Failed to notify: ") + v->path_name); 
    602610          } 
    603611        } 
  • scripts/python/test.py

    r04ef932 r54ac968  
    33core = Core.get() 
    44 
     5prefix = 'py_' 
    56def test(arguments): 
    67  log('inside test') 
    78  for a in arguments: 
    89    log('Got argument: %s'%a) 
    9   (retcode, msg, perf) = core.simple_query("normal", []) 
     10  (retcode, msg, perf) = core.simple_query("%snormal"%prefix, []) 
    1011  if msg != "ok got: ": 
    1112    return (status.CRITICAL, "Test failed") 
    12   (retcode, msg, perf) = core.simple_query("normal", ["hello"]) 
     13  (retcode, msg, perf) = core.simple_query("%snormal"%prefix, ["hello"]) 
    1314  if msg != "ok got: hello": 
    1415    return (status.CRITICAL, "Test failed") 
    15   (retcode, msg, perf) = core.simple_query("normal", ["hello", "world"]) 
     16  (retcode, msg, perf) = core.simple_query("%snormal"%prefix, ["hello", "world"]) 
    1617  if perf != "'args'=2": 
    1718    return (status.CRITICAL, "Test failed: -%s-"%perf) 
     
    4445   
    4546def init(alias): 
    46   prefix = 'py_' 
    4747  if alias: 
    4848    prefix = '%s_'%alias 
  • service/core_api.cpp

    r7ec3dd1 r54ac968  
    5353  try { 
    5454    return nscapi::plugin_helper::wrapReturnString(buffer, bufLen, settings_manager::get_settings()->get_string(section, key, defaultValue), NSCAPI::isSuccess); 
    55   } catch (...) { 
    56     LOG_ERROR_STD(_T("Failed to getString: ") + key); 
     55  } catch (settings::settings_exception e) { 
     56    LOG_ERROR_STD(_T("Failed to set settings file") + e.getMessage()); 
     57    return NSCAPI::hasFailed; 
     58  } catch (const std::exception &e) { 
     59    LOG_ERROR_STD(_T("Failed to get key: ") + utf8::cvt<std::wstring>(e.what())); 
     60    return NSCAPI::hasFailed; 
     61  } catch (...) { 
     62    LOG_ERROR_STD(_T("Failed to get key: <UNKNOWN EXCEPTION>")); 
    5763    return NSCAPI::hasFailed; 
    5864  } 
     
    6470    LOG_ERROR_STD(_T("Failed to set settings file") + e.getMessage()); 
    6571    return defaultValue; 
     72  } catch (const std::exception &e) { 
     73    LOG_ERROR_STD(_T("Failed to get key: ") + utf8::cvt<std::wstring>(e.what())); 
     74    return defaultValue; 
     75  } catch (...) { 
     76    LOG_ERROR_STD(_T("Failed to get key: <UNKNOWN EXCEPTION>")); 
     77    return defaultValue; 
    6678  } 
    6779} 
     
    7082    return settings_manager::get_settings()->get_bool(section, key, defaultValue==1); 
    7183  } catch (settings::settings_exception e) { 
    72     LOG_ERROR_STD(_T("Failed to set settings file") + e.getMessage()); 
     84    LOG_ERROR_STD(_T("Failed to get key: ") + e.getMessage()); 
     85    return defaultValue; 
     86  } catch (const std::exception &e) { 
     87    LOG_ERROR_STD(_T("Failed to get key: ") + utf8::cvt<std::wstring>(e.what())); 
     88    return defaultValue; 
     89  } catch (...) { 
     90    LOG_ERROR_STD(_T("Failed to get key: <UNKNOWN EXCEPTION>")); 
    7391    return defaultValue; 
    7492  } 
Note: See TracChangeset for help on using the changeset viewer.