@@ -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 ();
0 commit comments