aboutsummaryrefslogtreecommitdiff
path: root/client/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/main.cpp')
-rw-r--r--client/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/main.cpp b/client/main.cpp
index 6aad0e3..36fc7bb 100644
--- a/client/main.cpp
+++ b/client/main.cpp
@@ -1,6 +1,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstdint>
+#include <exception>
#include "rl.h"
#include "sock.h"
@@ -16,8 +17,13 @@ int main(int argc, char** argv) {
uint16_t port = 9191;
if (argc >= 3) port = atoi(argv[2]);
- // connect to TCP socket (automatically spawns thread)
- PBSocket sock(addr, port);
+ try {
+ // connect to TCP socket (automatically spawns thread)
+ PBSocket sock(addr, port);
+ } catch (const std::exception& e) {
+ printf("error: %s\n", e.what());
+ return EXIT_FAILURE;
+ }
// enter main CLI (using GNU readline for comfyness)
return cli_main();