Main, ...: catch any exception, not just std::runtime_error

This commit is contained in:
Max Kellermann
2017-12-19 10:56:23 +01:00
parent a539094c06
commit 914df18bf9
79 changed files with 236 additions and 244 deletions

View File

@@ -24,8 +24,6 @@
#include "util/StringBuffer.hxx"
#include "Compiler.h"
#include <stdexcept>
#include <unistd.h>
#include <stdio.h>
@@ -83,7 +81,7 @@ FakeDecoder::Read(InputStream &is, void *buffer, size_t length)
{
try {
return is.LockRead(buffer, length);
} catch (const std::runtime_error &e) {
} catch (...) {
return 0;
}
}

View File

@@ -43,7 +43,7 @@ public:
try {
IcuConverter::Create("doesntexist");
CPPUNIT_FAIL("Exception expected");
} catch (const std::runtime_error &) {
} catch (...) {
}
}
@@ -56,7 +56,7 @@ public:
try {
auto f = converter->FromUTF8(i);
CPPUNIT_FAIL("Exception expected");
} catch (const std::runtime_error &) {
} catch (...) {
}
}

View File

@@ -23,6 +23,8 @@
#include "event/Loop.hxx"
#include "Log.hxx"
#include <exception>
#include <sys/inotify.h>
static constexpr unsigned IN_MASK =
@@ -59,7 +61,7 @@ try {
event_loop.Run();
return EXIT_SUCCESS;
} catch (const std::runtime_error &e) {
LogError(e);
} catch (...) {
LogError(std::current_exception());
return EXIT_FAILURE;
}

View File

@@ -23,7 +23,7 @@
#include "net/SocketAddress.hxx"
#include "Log.hxx"
#include <stdexcept>
#include <exception>
#ifdef _WIN32
#include <ws2tcpip.h>
@@ -53,7 +53,7 @@ try {
freeaddrinfo(ai);
return EXIT_SUCCESS;
} catch (const std::runtime_error &e) {
LogError(e);
} catch (...) {
LogError(std::current_exception());
return EXIT_FAILURE;
}