MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Loading...
Searching...
No Matches
Error.hh
1
4//
5// This file is part of MARLEY (Model of Argon Reaction Low Energy Yields)
6//
7// MARLEY is free software: you can redistribute it and/or modify it under the
8// terms of version 3 of the GNU General Public License as published by the
9// Free Software Foundation.
10//
11// For the full text of the license please see COPYING or
12// visit http://opensource.org/licenses/GPL-3.0
13//
14// Please respect the MCnet academic usage guidelines. See GUIDELINES
15// or visit https://www.montecarlonet.org/GUIDELINES for details.
16
17#pragma once
18#include <exception>
19#include <string>
20
21namespace marley {
22
26 class Error : public std::exception {
27
28 public:
29
32 inline explicit Error( const char* message ) : msg_(message) {}
33
36 inline explicit Error( const std::string& message ) : msg_(message) {}
37
38 inline virtual ~Error() {}
39
41 inline virtual const char* what() const noexcept { return msg_.c_str(); }
42
43 protected:
44
45 std::string msg_; //< error message
46 };
47}
Base class for all exceptions thrown by MARLEY functions.
Definition Error.hh:26
Error(const std::string &message)
Definition Error.hh:36
Error(const char *message)
Definition Error.hh:32
virtual const char * what() const noexcept
Method called by the C++ standard library to display the error message.
Definition Error.hh:41