X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5089a0a98b27f5eeee62321dff4f025f1648f025..c86fbd9ddd59c63d254ddc5f9f661889419df5f9:/include/simgrid/Exception.hpp diff --git a/include/simgrid/Exception.hpp b/include/simgrid/Exception.hpp index 7f3918f085..b7ab71f179 100644 --- a/include/simgrid/Exception.hpp +++ b/include/simgrid/Exception.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2018-2020. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -64,6 +64,12 @@ public: ~ImpossibleError(); }; +class XBT_PUBLIC InitializationError : public std::logic_error { +public: + explicit InitializationError(const std::string& arg) : std::logic_error(arg) {} + ~InitializationError(); +}; + class XBT_PUBLIC UnimplementedError : public std::logic_error { public: explicit UnimplementedError(const std::string& arg) : std::logic_error(arg) {} @@ -79,6 +85,8 @@ public: : std::runtime_error(std::move(message)), throwpoint_(std::move(throwpoint)) { } + Exception(const Exception&) = default; + Exception(Exception&&) noexcept = default; ~Exception(); // DO NOT define it here -- see Exception.cpp for a rationale /** Return the information about where the exception was thrown */ @@ -100,6 +108,9 @@ public: : Exception(std::move(throwpoint), std::move(message)) { } + TimeoutException(const TimeoutException&) = default; + TimeoutException(TimeoutException&&) noexcept = default; + ~TimeoutException(); }; XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::TimeoutException") typedef TimeoutException TimeoutError; @@ -111,6 +122,9 @@ public: : Exception(std::move(throwpoint), std::move(message)) { } + HostFailureException(const HostFailureException&) = default; + HostFailureException(HostFailureException&&) noexcept = default; + ~HostFailureException(); }; /** Exception raised when a communication fails because of the network or because of the remote host */ @@ -120,6 +134,9 @@ public: : Exception(std::move(throwpoint), std::move(message)) { } + NetworkFailureException(const NetworkFailureException&) = default; + NetworkFailureException(NetworkFailureException&&) noexcept = default; + ~NetworkFailureException(); }; /** Exception raised when a storage fails */ @@ -129,6 +146,9 @@ public: : Exception(std::move(throwpoint), std::move(message)) { } + StorageFailureException(const StorageFailureException&) = default; + StorageFailureException(StorageFailureException&&) noexcept = default; + ~StorageFailureException(); }; /** Exception raised when a VM fails */ @@ -138,6 +158,9 @@ public: : Exception(std::move(throwpoint), std::move(message)) { } + VmFailureException(const VmFailureException&) = default; + VmFailureException(VmFailureException&&) noexcept = default; + ~VmFailureException(); }; /** Exception raised when something got canceled before completion */ @@ -147,6 +170,9 @@ public: : Exception(std::move(throwpoint), std::move(message)) { } + CancelException(const CancelException&) = default; + CancelException(CancelException&&) noexcept = default; + ~CancelException(); }; /** Exception raised when something is going wrong during the simulation tracing */ @@ -156,23 +182,21 @@ public: : Exception(std::move(throwpoint), std::move(message)) { } + TracingError(const TracingError&) = default; + TracingError(TracingError&&) noexcept = default; + ~TracingError(); }; -class XBT_PUBLIC ParseError : public Exception, public std::invalid_argument { - int line_; - std::string file_; - std::string msg_; - +/** Exception raised when something is going wrong during the parsing of XML files */ +class ParseError : public Exception { public: - ParseError(int line, std::string& file, std::string&& msg) - : Exception(XBT_THROW_POINT, std::move(msg)), std::invalid_argument(msg), line_(line), file_(file), msg_(msg) - { - } - - const char* what() const noexcept override + ParseError(const std::string& file, int line, const std::string& msg) + : Exception(XBT_THROW_POINT, xbt::string_printf("Parse error at %s:%d: %s", file.c_str(), line, msg.c_str())) { - return bprintf("Parse error at %s:%d: %s", file_.c_str(), line_, msg_.c_str()); } + ParseError(const ParseError&) = default; + ParseError(ParseError&&) noexcept = default; + ~ParseError(); }; class XBT_PUBLIC ForcefulKillException {