public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Show a better error message if the ApplicationPool server exited 
unexpectedly.
Hongli Lai (Phusion) (author)
Wed May 07 09:13:39 -0700 2008
commit  726d5ef8ace10ef0a7179851b67ba43217c5dcee
tree    4f5312fff20017cab05b35f6662793309cadba3d
parent  b7f380596c7af3e41c868199466047294fccdf3e
...
262
263
264
265
266
267
 
 
 
 
 
 
 
268
269
270
...
489
490
491
492
493
 
 
 
494
495
496
 
 
497
498
499
 
 
 
 
 
 
 
 
 
500
501
502
...
262
263
264
 
 
 
265
266
267
268
269
270
271
272
273
274
...
493
494
495
 
 
496
497
498
499
 
 
500
501
502
 
 
503
504
505
506
507
508
509
510
511
512
513
514
0
@@ -262,9 +262,13 @@ private:
0
       vector<string> args;
0
       int reader, writer;
0
       
0
- channel.write("get", appRoot.c_str(),
0
- (lowerPrivilege) ? "true" : "false",
0
- lowestUser.c_str(), NULL);
0
+ try {
0
+ channel.write("get", appRoot.c_str(),
0
+ (lowerPrivilege) ? "true" : "false",
0
+ lowestUser.c_str(), NULL);
0
+ } catch (const SystemException &) {
0
+ throw IOException("The ApplicationPool server exited unexpectedly.");
0
+ }
0
       if (!channel.read(args)) {
0
         throw IOException("The ApplicationPool server unexpectedly closed the connection.");
0
       }
0
@@ -489,14 +493,22 @@ public:
0
    * @throws IOException Something went wrong.
0
    */
0
   ApplicationPoolPtr connect() {
0
- MessageChannel channel(serverSocket);
0
- int clientConnection;
0
+ try {
0
+ MessageChannel channel(serverSocket);
0
+ int clientConnection;
0
     
0
- // Write some random data to wake up the server.
0
- channel.writeRaw("x", 1);
0
+ // Write some random data to wake up the server.
0
+ channel.writeRaw("x", 1);
0
     
0
- clientConnection = channel.readFileDescriptor();
0
- return ptr(new Client(clientConnection));
0
+ clientConnection = channel.readFileDescriptor();
0
+ return ptr(new Client(clientConnection));
0
+ } catch (const SystemException &e) {
0
+ throw SystemException("Could not connect to the ApplicationPool server", e.code());
0
+ } catch (const IOException &e) {
0
+ string message("Could not connect to the ApplicationPool server: ");
0
+ message.append(e.what());
0
+ throw IOException(message);
0
+ }
0
   }
0
   
0
   /**

Comments

    No one has commented yet.