diff options
Diffstat (limited to 'server/src/client_connection.cc')
| -rw-r--r-- | server/src/client_connection.cc | 19 | 
1 files changed, 17 insertions, 2 deletions
diff --git a/server/src/client_connection.cc b/server/src/client_connection.cc index b9d17b9..c3de7b0 100644 --- a/server/src/client_connection.cc +++ b/server/src/client_connection.cc @@ -108,6 +108,7 @@ void ClientConnection::nocommit(Session *session)  }  void ClientConnection::commit(Session *session) +  throw(LUAScript::Exception, Journal::Exception)  {    if(docommit) {      if(session->isReadonly()) { // Commit of an empty session discards it. @@ -117,7 +118,13 @@ void ClientConnection::commit(Session *session)      DEBUG(connection, "Commit (%s)\n", session->id().c_str());      std::string sid = session->id(); -    session->commit(); +    try { +      session->commit(); +    } catch(LUAScript::Exception &e) { +      throw e; +    } catch(Journal::Exception &e) { +      throw e; +    }      env.sessions.deleteSession(sid);      sessionid = "";      docommit = false; @@ -208,7 +215,15 @@ bool ClientConnection::handle()        response = handleTransaction(request, transaction, env, *session);      } -    commit(session); +    try { +      commit(session); +    } catch(LUAScript::Exception &e) { +      response = error_box(xml_encode(e.msg)); +      return true; +    } catch(Journal::Exception &e) { +      response = error_box(xml_encode(e.msg)); +      return true; +    }      nocommit(session);      discard(session);  | 
