tbolier/php-rethink-ql

Runtime error if user has no rights granted

Opened this issue · 1 comments

To test I'm now using this code:

$r = new Rethink($registry->getConnection('default'));
$r->connection()->connect();
$r->db()
  ->tableCreate('test')
  ->run();

I'm getting a Runtime Error:

PHP Fatal error:  Uncaught TBolier\RethinkQL\Connection\ConnectionException: Runtime error: U, jsonQuery: [1,[60,[[1,"test"]]],{"db":[14,["vagrant"]]}] in/code/vendor/tbolier/php-rethink-ql/src/Connection/Connection.php:372
Stack trace:
#0 /code/vendor/tbolier/php-rethink-ql/src/Connection/Connection.php(334): TBolier\RethinkQL\Connection\Connection->validateResponse(Object(TBolier\RethinkQL\Response\Response), 820726866, 820726866, Object(TBolier\RethinkQL\Message\Message))
#1 /code/vendor/tbolier/php-rethink-ql/src/Connection/Connection.php(169): TBolier\RethinkQL\Connection\Connection->receiveResponse(820726866, Object(TBolier\RethinkQL\Message\Message))
#2 /code/vendor/tbolier/php-rethink-ql/src/Query/AbstractQuery.php(32): TBolier\RethinkQL\Connection\Connection->run(Object(TBolier\RethinkQL\Message\Message))
#3 /code/bin/OrderBook.php(28): TBolier\RethinkQL\Query\AbstractQuery->run()
#4 {main}

Next TBolier\RethinkQL\Connection\ConnectionException: Runtime error: U, jsonQuery: [1,[60,[[1,"test"]]],{"db":[14,["vagrant"]] in /code/vendor/tbolier/php-rethink-ql/src/Connection/Connection.php on line 181

This is because I did not grant the permissions to the user yet. Might need a different error message.

Originally posted by @mpjraaij in #76 (comment)

Hi @mpjraaij

Thanks for reporting this one. Right now any RethinkDB error is passed back directly to the client. There is no interpreter in between that generates a friendly error for the client. I will need to think about a good solution for this.