PRISMS-PF Manual
Loading...
Searching...
No Matches
exceptions.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2025 PRISMS Center at the University of Michigan
2// SPDX-License-Identifier: GNU Lesser General Public Version 2.1
3
4#pragma once
5
6#include <deal.II/base/exceptions.h>
7
9
10#include <prismspf/config.h>
11
12#include <exception>
13
15
16// NOLINTBEGIN(readability-identifier-naming)
17
23#ifdef DEBUG
24# define AssertThrowDebug(cond, exc) AssertThrow(cond, exc);
25#else
26# define AssertThrowDebug(cond, exc)
27#endif
28
29// NOLINTEND(readability-identifier-naming)
30
31// NOLINTBEGIN
32
33class ExcNaN : public std::exception
34{
35private:
36 std::string message;
37
38public:
39 // Constructor to store a custom message
40 explicit ExcNaN(const std::string &msg = "")
41 : message("PRISMS-PF detected somewhere that a value was NaN.\n" + msg)
42 {}
43
44 // Overriding the virtual what() method
45 const char *
46 what() const noexcept override
47 {
48 return message.c_str();
49 }
50};
51
57 FeatureNotImplemented,
58 std::string,
59 << "The following feature has yet to be implemented in PRISMS-PF:\n " << arg1
60 << "\nCheck the issues section of PRISMS-PF's github to see if this feature is under "
61 "development. Additionally, please considering provided a patch to PRISMS-PF if you "
62 "feel that feature is worthwhile for yourself and others.");
63
68DeclExceptionMsg(UnreachableCode, "This code should not have been reached.");
69
74DeclException2(DependencyNotFound,
76 std::string,
77 << "Attempted access of the variable with index " << arg1
78 << " and dependency type " << arg2
79 << " that was not marked as needed. Please check CustomAttributeLoader.");
80
81// NOLINTEND
82
83PRISMS_PF_END_NAMESPACE
std::string message
Definition exceptions.h:36
ExcNaN(const std::string &msg="")
Definition exceptions.h:40
const char * what() const noexcept override
Definition exceptions.h:46
DeclExceptionMsg(UnreachableCode, "This code should not have been reached.")
DeclException2(DependencyNotFound, Types::Index, std::string,<< "Attempted access of the variable with index "<< arg1<< " and dependency type "<< arg2<< " that was not marked as needed. Please check CustomAttributeLoader.")
DeclException1(FeatureNotImplemented, std::string,<< "The following feature has yet to be implemented in PRISMS-PF:\n "<< arg1<< "\nCheck the issues section of PRISMS-PF's github to see if this feature is under " "development. Additionally, please considering provided a patch to PRISMS-PF if you " "feel that feature is worthwhile for yourself and others.")
Definition conditional_ostreams.cc:20
unsigned int Index
Type for field indices.
Definition types.h:19