--- /dev/null
+/* Copyright (c) 2018. 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. */
+
+#ifndef SIMGRID_EXCEPTIONS_HPP
+#define SIMGRID_EXCEPTIONS_HPP
+
+/** @file exception.hpp SimGrid-specific Exceptions
+ *
+ * Defines all possible exception that could occur in a SimGrid library.
+ */
+
+#include <exception>
+
+namespace simgrid {
+
+/** Ancestor class of all SimGrid exception */
+class exception : public std::runtime_error {
+public:
+ exception() : std::runtime_error("") {}
+ exception(const char* message) : std::runtime_error(message) {}
+};
+
+/** Exception raised when a timeout elapsed */
+class timeout_error : public simgrid::exception {
+};
+
+/** Exception raised when an host fails */
+class host_failure : public simgrid::exception {
+};
+
+/** Exception raised when a communication fails because of the network */
+class network_failure : public simgrid::exception {
+};
+
+/** Exception raised when something got canceled before completion */
+class cancel_error : public simgrid::exception {
+};
+
+} // namespace simgrid
+
+#endif
*/
#define THROWF(c, v, ...) _xbt_throw(bprintf(__VA_ARGS__), (xbt_errcat_t) c, v, __FILE__, __LINE__, __func__)
-/** Throw an exception because someting impossible happened
+/** Throw an exception because something impossible happened
* @ingroup XBT_ex_c
*/
#define THROW_IMPOSSIBLE \
THROWF(unknown_error, 0, "The Impossible Did Happen (yet again)")
-/** Throw an exception because someting unimplemented stuff has been attempted
+/** Throw an exception because something unimplemented stuff has been attempted
* @ingroup XBT_ex_c
*/
#define THROW_UNIMPLEMENTED \
-/* Copyright (c) 2005-2018. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2005-2018. 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. */
#ifndef SIMGRID_XBT_EX_HPP
#define SIMGRID_XBT_EX_HPP
+#include <simgrid/exception.hpp>
#include <stdexcept>
#include <xbt/exception.hpp>
*
* @ingroup XBT_ex_c
*/
-class XBT_PUBLIC xbt_ex : public std::runtime_error, public simgrid::xbt::WithContextException {
+class XBT_PUBLIC xbt_ex : public simgrid::exception, public simgrid::xbt::WithContextException {
public:
- xbt_ex() :
- std::runtime_error("")
- {}
+ xbt_ex() : simgrid::exception() {}
/**
*
* @param throwpoint Throw point (use XBT_THROW_POINT)
* @param message Exception message
*/
- xbt_ex(simgrid::xbt::ThrowPoint throwpoint, const char* message) :
- std::runtime_error(message),
- simgrid::xbt::WithContextException(throwpoint, simgrid::xbt::backtrace())
+ xbt_ex(simgrid::xbt::ThrowPoint throwpoint, const char* message)
+ : simgrid::exception(message), simgrid::xbt::WithContextException(throwpoint, simgrid::xbt::backtrace())
{}
~xbt_ex(); // DO NOT define it here -- see ex.cpp for a rationale
include/simgrid/actor.h
include/simgrid/barrier.h
include/simgrid/engine.h
+ include/simgrid/exception.hpp
include/simgrid/chrono.hpp
include/simgrid/plugins/dvfs.h
include/simgrid/plugins/energy.h