Verified Commit ce363705 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Report previosly unhandled errors in workers

1. Catch `std::system_error`s, log them, and report them as Cargo
   system errors.
2. Catch and report `std:::exception`s, log them, and report them as
   Cargo `error_code::other`
parent eaed9c2a
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -144,8 +144,12 @@ mpio_read::operator()() const {
    } catch(const posix_file::io_error& e) {
    } catch(const posix_file::io_error& e) {
        LOGGER_ERROR("{}() failed: {}", e.where(), e.what());
        LOGGER_ERROR("{}() failed: {}", e.where(), e.what());
        return make_system_error(e.error_code());
        return make_system_error(e.error_code());
    } catch (const std::system_error& e) {
        LOGGER_ERROR("Unexpected system error: {}", e.what());
        return make_system_error(e.code().value());
    } catch(const std::exception& e) {
    } catch(const std::exception& e) {
        std::cerr << e.what() << '\n';
        LOGGER_ERROR("Unexpected exception: {}", e.what());
        return error_code::other;
    }
    }


    return error_code::success;
    return error_code::success;
+5 −1
Original line number Original line Diff line number Diff line
@@ -146,8 +146,12 @@ mpio_write::operator()() const {
    } catch(const posix_file::io_error& e) {
    } catch(const posix_file::io_error& e) {
        LOGGER_ERROR("{}() failed: {}", e.where(), e.what());
        LOGGER_ERROR("{}() failed: {}", e.where(), e.what());
        return make_system_error(e.error_code());
        return make_system_error(e.error_code());
    } catch (const std::system_error& e) {
        LOGGER_ERROR("Unexpected system error: {}", e.what());
        return make_system_error(e.code().value());
    } catch(const std::exception& e) {
    } catch(const std::exception& e) {
        std::cerr << e.what() << '\n';
        LOGGER_ERROR("Unexpected exception: {}", e.what());
        return error_code::other;
    }
    }


    return error_code::success;
    return error_code::success;