https://mooseframework.inl.gov
CapabilityException.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "StreamArguments.h"
13 
14 #include <exception>
15 #include <string>
16 #include <vector>
17 
18 namespace Moose
19 {
23 class CapabilityException : public std::runtime_error
24 {
25 public:
26  CapabilityException(const CapabilityException &) = default;
27 
28  template <typename... Args>
29  static std::string stringify(Args &&... args)
30  {
31  std::ostringstream ss;
32  streamArguments(ss, args...);
33  return ss.str();
34  }
35 
36  template <typename... Args>
37  explicit CapabilityException(Args &&... args) : std::runtime_error(stringify(args...))
38  {
39  }
40 
41  ~CapabilityException() throw() {}
42 };
43 
48 {
49 public:
50  UnknownCapabilitiesException(const std::vector<std::string> & unknown_capabilities);
51 
53  const std::vector<std::string> unknown_capabilities;
54 };
55 }
static std::string stringify(Args &&... args)
void streamArguments(StreamType &)
const std::vector< std::string > unknown_capabilities
The capabilities that are unknown.
CapabilityException(Args &&... args)
UnknownCapabilitiesException(const std::vector< std::string > &unknown_capabilities)
CapabilityException(const CapabilityException &)=default
Common execption to be thrown when interacting with capabilities.
Exception thrown when capabilities are unknown.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...