thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bill fumerola <bi...@mu.org>
Subject Re: generated php code, what are the values of the constructor param?
Date Fri, 18 Sep 2009 18:43:52 GMT
On Fri, Sep 18, 2009 at 11:07:10AM -0700, Simon Chu wrote:
> i)  is the C, cpp interface similar, please give example

c++ interface is as identical as a php and c++ implementation can be.

shared_ptr<TSocket> socket (new TSocket(host, port));
shared_ptr<TTransport> transport (new TBufferedTransport(socket);
shared_ptr<TProtocol> protocol (new TBinaryProtocol(transport));
shared_ptr<myClient> client (new myClient(protocol);

try {
  transport->open();
  int ret = client->someCallReturnsInt();
} catch (exception &e) {
  cout << "exception: " << e.what() << endl;
}

> ii)  I got further.  Where is TException defined?  What is the method to
> print out exception message?

TException inherits from Exception.

http://svn.apache.org/repos/asf/incubator/thrift/trunk/lib/php/src/Thrift.php

http://us2.php.net/manual/en/language.exceptions.php

e.g.
try {
  $transport->open();
} catch (Exception $e) {
  echo $e->getMessage();
}


-- bill

Mime
View raw message