LHAPDF  6.5.4
Exceptions.h
1 // -*- C++ -*-
2 //
3 // This file is part of LHAPDF
4 // Copyright (C) 2012-2023 The LHAPDF collaboration (see AUTHORS for details)
5 //
6 #pragma once
7 #ifndef LHAPDF_Exceptions_H
8 #define LHAPDF_Exceptions_H
9 
10 #include <exception>
11 #include <stdexcept>
12 
13 namespace LHAPDF {
14 
15 
16  /// @defgroup exceptions Exception classes for error handling
17  ///@{
18 
19  /// @brief Generic unspecialised LHAPDF runtime error.
20  ///
21  /// NB. We don't use "Error" because that has a physics meaning!
22  class Exception : public std::runtime_error {
23  public:
24  /// Constructor with error description string
25  Exception(const std::string& what) : std::runtime_error(what) {}
26  };
27 
28 
29  /// Error for general PDF grid problems.
30  class GridError : public Exception {
31  public:
32  /// Constructor with error description string
33  GridError(const std::string& what) : Exception(what) {}
34  };
35 
36 
37  /// Error to be thrown when out of the valid range of a PDF.
38  class RangeError : public Exception {
39  public:
40  /// Constructor with error description string
41  RangeError(const std::string& what) : Exception(what) {}
42  };
43 
44 
45  /// Error for places where it should not have been possible to get to!
46  class LogicError : public Exception {
47  public:
48  /// Constructor with error description string
49  LogicError(const std::string& what) : Exception(what) {}
50  };
51 
52 
53  /// @brief Error for unfound or broken metadata entries.
54  class MetadataError : public Exception {
55  public:
56  /// Constructor with error description string
57  MetadataError(const std::string& what) : Exception(what) {}
58  };
59 
60 
61  /// @brief Error for file reading errors.
62  class ReadError : public Exception {
63  public:
64  /// Constructor with error description string
65  ReadError(const std::string& what) : Exception(what) {}
66  };
67 
68 
69  /// @brief Error for requests for unsupported/invalid flavour PIDs.
70  class FlavorError : public Exception {
71  public:
72  /// Constructor with error description string
73  FlavorError(const std::string& what) : Exception(what) {}
74  };
75 
76 
77  /// @brief Error to be raised by object factories given invalid requests.
78  class FactoryError : public Exception {
79  public:
80  /// Constructor with error description string
81  FactoryError(const std::string& what) : Exception(what) {}
82  };
83 
84 
85  /// @brief Error to be raised when a LHAPDF ID indexing fails
86  class IndexError : public Exception {
87  public:
88  /// Constructor with error description string
89  IndexError(const std::string& what) : Exception(what) {}
90  };
91 
92 
93  /// Error for general AlphaS computation problems.
94  class AlphaSError : public Exception {
95  public:
96  /// Constructor with error description string
97  AlphaSError(const std::string& what) : Exception(what) {}
98  };
99 
100 
101  /// @brief Error to be raised when a newer LHAPDF version is needed
102  class VersionError : public Exception {
103  public:
104  /// Constructor with error description string
105  VersionError(const std::string& what) : Exception(what) {}
106  };
107 
108 
109  /// Problem exists between keyboard and chair
110  class UserError : public Exception {
111  public:
112  /// Constructor with error description string
113  UserError(const std::string& what) : Exception(what) {}
114  };
115 
116 
117  /// This feature doesn't exist yet
119  public:
120  /// Constructor with error description string
121  NotImplementedError(const std::string& what) : Exception(what) {}
122  };
123 
124  ///@}
125 
126 
127 }
128 #endif