Skip to content

Commit cfcb0cc

Browse files
committed
removed NodeOracleException
1 parent 0bc878f commit cfcb0cc

File tree

5 files changed

+12
-33
lines changed

5 files changed

+12
-33
lines changed

src/connection.cpp

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ Handle<Value> Connection::Execute(const Arguments& args) {
5757

5858
String::Utf8Value sqlVal(sql);
5959

60-
ExecuteBaton* baton;
61-
try {
62-
baton = new ExecuteBaton(connection, *sqlVal, &values, &callback);
63-
} catch(NodeOracleException &ex) {
64-
return scope.Close(ThrowException(Exception::Error(String::New(ex.getMessage().c_str()))));
60+
ExecuteBaton* baton = new ExecuteBaton(connection, *sqlVal, &values, &callback);
61+
if (baton->error) {
62+
Local<String> message = String::New(baton->error->c_str());
63+
delete baton;
64+
return scope.Close(ThrowException(Exception::Error(message)));
6565
}
6666

6767
uv_work_t* req = new uv_work_t();
@@ -102,12 +102,7 @@ Handle<Value> Connection::Commit(const Arguments& args) {
102102

103103
REQ_FUN_ARG(0, callback);
104104

105-
CommitBaton* baton;
106-
try {
107-
baton = new CommitBaton(connection, &callback);
108-
} catch(NodeOracleException &ex) {
109-
return scope.Close(ThrowException(Exception::Error(String::New(ex.getMessage().c_str()))));
110-
}
105+
CommitBaton* baton = new CommitBaton(connection, &callback);
111106

112107
uv_work_t* req = new uv_work_t();
113108
req->data = baton;
@@ -124,12 +119,7 @@ Handle<Value> Connection::Rollback(const Arguments& args) {
124119

125120
REQ_FUN_ARG(0, callback);
126121

127-
RollbackBaton* baton;
128-
try {
129-
baton = new RollbackBaton(connection, &callback);
130-
} catch(NodeOracleException &ex) {
131-
return scope.Close(ThrowException(Exception::Error(String::New(ex.getMessage().c_str()))));
132-
}
122+
RollbackBaton* baton = new RollbackBaton(connection, &callback);
133123

134124
uv_work_t* req = new uv_work_t();
135125
req->data = baton;
@@ -484,8 +474,6 @@ void Connection::EIO_Execute(uv_work_t* req) {
484474
}
485475
} catch(oracle::occi::SQLException &ex) {
486476
baton->error = new string(ex.getMessage());
487-
} catch(NodeOracleException &ex) {
488-
baton->error = new string(ex.getMessage());
489477
} catch (const exception& ex) {
490478
baton->error = new string(ex.what());
491479
} catch (...) {
@@ -681,11 +669,6 @@ void Connection::EIO_AfterExecute(uv_work_t* req, int status) {
681669
Handle<Value> argv[2];
682670
handleResult(baton, argv);
683671
node::MakeCallback(Context::GetCurrent()->Global(), baton->callback, 2, argv);
684-
} catch(NodeOracleException &ex) {
685-
Handle<Value> argv[2];
686-
argv[0] = Exception::Error(String::New(ex.getMessage().c_str()));
687-
argv[1] = Undefined();
688-
node::MakeCallback(Context::GetCurrent()->Global(), baton->callback, 2, argv);
689672
} catch(const exception &ex) {
690673
Handle<Value> argv[2];
691674
argv[0] = Exception::Error(String::New(ex.what()));
@@ -810,11 +793,11 @@ Handle<Value> Connection::ExecuteSync(const Arguments& args) {
810793

811794
String::Utf8Value sqlVal(sql);
812795

813-
ExecuteBaton* baton;
814-
try {
815-
baton = new ExecuteBaton(connection, *sqlVal, &values, NULL);
816-
} catch(NodeOracleException &ex) {
817-
return ThrowException(Exception::Error(String::New(ex.getMessage().c_str())));
796+
ExecuteBaton* baton = new ExecuteBaton(connection, *sqlVal, &values, NULL);
797+
if (baton->error) {
798+
Local<String> message = String::New(baton->error->c_str());
799+
delete baton;
800+
return scope.Close(ThrowException(Exception::Error(message)));
818801
}
819802

820803
uv_work_t* req = new uv_work_t();

src/connection.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <occi.h>
1111
#include <oro.h>
1212
#include "utils.h"
13-
#include "nodeOracleException.h"
1413
#include "executeBaton.h"
1514

1615
using namespace node;

src/executeBaton.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
#include "executeBaton.h"
33
#include "outParam.h"
4-
#include "nodeOracleException.h"
54
#include "connection.h"
65
#include <iostream>
76
using namespace std;

src/nodeOracleException.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#define _nodeOracleException_h_
44

55
#include <string>
6-
76
class NodeOracleException {
87
public:
98
NodeOracleException(std::string message) : m_message(message) {

src/outParam.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
#include "outParam.h"
3-
#include "nodeOracleException.h"
43
#include <iostream>
54
using namespace std;
65

0 commit comments

Comments
 (0)