@@ -36,7 +36,8 @@ namespace arangodb { namespace fuerte { namespace php {
3636 int threadCount = params[0 ];
3737
3838 if (threadCount < 1 ) {
39- throw Php::Exception (" Invalid threadCount provided, must be >= 1" );
39+ ARANGODB_THROW (InvalidArgumentException (), " Invalid threadCount provided, must be >= 1 in %s on line %d" );
40+ return ;
4041 }
4142
4243 this ->threadCount = threadCount;
@@ -47,7 +48,8 @@ namespace arangodb { namespace fuerte { namespace php {
4748 int defaultTimeout = params[0 ];
4849
4950 if (defaultTimeout < 1 ) {
50- throw Php::Exception (" Invalid defaultTimeout provided, must be >= 1" );
51+ ARANGODB_THROW (InvalidArgumentException (), " Invalid defaultTimeout provided, must be >= 1 in %s on line %d" );
52+ return ;
5153 }
5254
5355 this ->defaultTimeout = defaultTimeout;
@@ -128,8 +130,10 @@ namespace arangodb { namespace fuerte { namespace php {
128130
129131 Php::Value Connection::send (Php::Parameters ¶ms)
130132 {
131- if (!params[0 ].instanceOf (" ArangoDb\\ Request" ))
132- throw Php::Exception (" Expected request to be of type Request" );
133+ if (!params[0 ].instanceOf (" ArangoDb\\ Request" )) {
134+ ARANGODB_THROW (InvalidArgumentException (), " Expected request to be of type Request in %s on line %d" );
135+ return NULL ;
136+ }
133137
134138 Request* request = (Request*)params[0 ].implementation ();
135139
@@ -139,11 +143,15 @@ namespace arangodb { namespace fuerte { namespace php {
139143
140144 void Connection::sendAsync (Php::Parameters ¶ms)
141145 {
142- if (!params[0 ].instanceOf (" ArangoDb\\ Request" ))
143- throw Php::Exception (" Expected request to be of type Request" );
146+ if (!params[0 ].instanceOf (" ArangoDb\\ Request" )) {
147+ ARANGODB_THROW (InvalidArgumentException (), " Expected request to be of type Request in %s on line %d" );
148+ return ;
149+ }
144150
145- if (!params[1 ].isCallable ())
146- throw Php::Exception (" Expected callback to be of type Callable" );
151+ if (!params[1 ].isCallable ()) {
152+ ARANGODB_THROW (InvalidArgumentException (), " Expected callback to be of type Callable in %s on line %d" );
153+ return ;
154+ }
147155
148156 Request* request = (Request*)params[0 ].implementation ();
149157 this ->sendRequestAsync (request, params[1 ]);
@@ -213,14 +221,17 @@ namespace arangodb { namespace fuerte { namespace php {
213221 this ->asyncWaitGroup = new fu::WaitGroup ();
214222
215223 if (!success) {
216- throw Php::Exception (" Sending request to ArangoDB failed" );
224+ ARANGODB_THROW (RuntimeException (), " Sending request to ArangoDB failed in %s on line %d" );
225+ return ;
217226 }
218227 }
219228
220229 Php::Value Connection::query (Php::Parameters ¶ms)
221230 {
222- if (!params[0 ].instanceOf (" ArangoDb\\ Vpack" ))
223- throw Php::Exception (" Expected vpack to be of type Vpack" );
231+ if (!params[0 ].instanceOf (" ArangoDb\\ Vpack" )) {
232+ ARANGODB_THROW (InvalidArgumentException (), " Expected vpack to be of type Vpack in %s on line %d" );
233+ return NULL ;
234+ }
224235
225236 Cursor* cursor = new Cursor (this , (Vpack*)params[0 ].implementation ());
226237
0 commit comments