Reduce catch all handlers, and make them optional.
[shibboleth/cpp-sp.git] / fastcgi / shibresponder.cpp
index f861807..f4d09b6 100644 (file)
@@ -31,7 +31,6 @@
 #include <fcgio.h>\r
 \r
 using namespace shibtarget;\r
-using namespace saml;\r
 using namespace std;\r
 \r
 typedef enum {\r
@@ -61,7 +60,7 @@ public:
             server_port = strtol(server_port_str, &server_port_str, 10);\r
             if (*server_port_str) {\r
                 cerr << "can't parse SERVER_PORT (" << FCGX_GetParam("SERVER_PORT", req->envp) << ")" << endl;\r
-                throw SAMLException("Unable to determine server port.");\r
+                throw exception("Unable to determine server port.");\r
             }\r
         }\r
 \r
@@ -121,30 +120,30 @@ public:
     }\r
 \r
     virtual void clearHeader(const string &name) {\r
-        throw SAMLException("clearHeader not implemented by FastCGI responder.");\r
+        throw exception("clearHeader not implemented by FastCGI responder.");\r
     }\r
   \r
     virtual void setHeader(const string &name, const string &value) {\r
-        throw SAMLException("setHeader not implemented by FastCGI responder.");\r
+        throw exception("setHeader not implemented by FastCGI responder.");\r
     }\r
 \r
     virtual string getHeader(const string &name) {\r
-        throw SAMLException("getHeader not implemented by FastCGI responder.");\r
+        throw exception("getHeader not implemented by FastCGI responder.");\r
     }\r
 \r
     virtual void setRemoteUser(const string &user) {\r
-        throw SAMLException("setRemoteUser not implemented by FastCGI responder.");\r
+        throw exception("setRemoteUser not implemented by FastCGI responder.");\r
     }\r
 \r
     virtual string getRemoteUser(void) {\r
-        throw SAMLException("getRemoteUser not implemented by FastCGI responder.");\r
+        throw exception("getRemoteUser not implemented by FastCGI responder.");\r
     }\r
 \r
     virtual void* sendPage(\r
         const string& msg,\r
         int code=200,\r
         const string& content_type="text/html",\r
-        const Iterator<header_t>& headers=EMPTY(header_t)) {\r
+        const saml::Iterator<header_t>& headers=EMPTY(header_t)) {\r
 \r
         string hdr = string ("Connection: close\r\nContent-type: ") + content_type + "\r\n" + m_cookie;\r
         while (headers.hasNext()) {\r
@@ -261,8 +260,8 @@ int main(void)
             exit(1);\r
         }\r
     }\r
-    catch (...) {\r
-        cerr << "exception while initializing Shibboleth configuration" << endl;\r
+    catch (exception& e) {\r
+        cerr << "exception while initializing Shibboleth configuration:" << e.what() << endl;\r
         exit(1);\r
     }\r
 \r
@@ -340,7 +339,7 @@ int main(void)
             }          \r
           \r
         }\r
-        catch (SAMLException& e) {\r
+        catch (exception& e) {\r
             cerr << "shib: FastCGI responder caught an exception: " << e.what() << endl;\r
             print_error("<html><body>FastCGI Shibboleth responder caught an exception, check log for details.</body></html>");\r
         }\r