| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a7d349a commit 6e98ee0
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,6 +41,7 @@ | |||
| 41 | 41 | #include <deque> | |
| 42 | 42 | ||
| 43 | 43 | #include <pthread.h> | |
| 44 | + #include <stdexcept> | ||
| 44 | 45 | ||
| 45 | 46 | #include "httpserver/create_webserver.hpp" | |
| 46 | 47 | ||
@@ -66,6 +67,15 @@ namespace details { | |||
| 66 | 67 | class comet_manager; | |
| 67 | 68 | } | |
| 68 | 69 | ||
| 70 | + class webserver_exception : public std::runtime_error | ||
| 71 | + { | ||
| 72 | + public: | ||
| 73 | + webserver_exception() | ||
| 74 | + : std::runtime_error("httpserver runtime error") | ||
| 75 | + { | ||
| 76 | + } | ||
| 77 | + }; | ||
| 78 | + | ||
| 69 | 79 | /** | |
| 70 | 80 | * Class representing the webserver. Main class of the apis. | |
| 71 | 81 | **/ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -280,7 +280,7 @@ void* webserver::select(void* self) | |||
| 280 | 280 | FD_ZERO (&ws); | |
| 281 | 281 | FD_ZERO (&es); | |
| 282 | 282 | if (MHD_YES != MHD_get_fdset (di->daemon, &rs, &ws, &es, &max)) | |
| 283 | - abort(); /* fatal internal error */ | ||
| 283 | + throw ::httpserver::webserver_exception(); /* fatal internal error */ | ||
| 284 | 284 | ||
| 285 | 285 | unsigned long long timeout_microsecs = 0; | |
| 286 | 286 | unsigned long long timeout_secs = 0; | |
@@ -563,7 +563,7 @@ bool webserver::start(bool blocking) | |||
| 563 | 563 | { | |
| 564 | 564 | cout << gettext("Unable to connect daemon to port: ") << | |
| 565 | 565 | this->port << endl; | |
| 566 | - abort(); | ||
| 566 | + throw ::httpserver::webserver_exception(); | ||
| 567 | 567 | } | |
| 568 | 568 | details::daemon_item* di = new details::daemon_item(this, daemon); | |
| 569 | 569 | daemons.push_back(di); | |
@@ -579,7 +579,7 @@ bool webserver::start(bool blocking) | |||
| 579 | 579 | static_cast<void*>(di) | |
| 580 | 580 | )) | |
| 581 | 581 | { | |
| 582 | - abort(); | ||
| 582 | + throw ::httpserver::webserver_exception(); | ||
| 583 | 583 | } | |
| 584 | 584 | } | |
| 585 | 585 | } | |
@@ -595,7 +595,7 @@ bool webserver::start(bool blocking) | |||
| 595 | 595 | { | |
| 596 | 596 | cout << gettext("Unable to connect daemon to port: ") << | |
| 597 | 597 | this->port << endl; | |
| 598 | - abort(); | ||
| 598 | + throw ::httpserver::webserver_exception(); | ||
| 599 | 599 | } | |
| 600 | 600 | details::daemon_item* di = new details::daemon_item(this, daemon); | |
| 601 | 601 | daemons.push_back(di); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments