LCOV - code coverage report
Current view: top level - include/base - CapabilityException.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 8 8 100.0 %
Date: 2026-05-29 20:35:17 Functions: 12 23 52.2 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : {
      20             : /**
      21             :  * Common execption to be thrown when interacting with capabilities.
      22             :  */
      23             : class CapabilityException : public std::runtime_error
      24             : {
      25             : public:
      26             :   CapabilityException(const CapabilityException &) = default;
      27             : 
      28             :   template <typename... Args>
      29         137 :   static std::string stringify(Args &&... args)
      30             :   {
      31         137 :     std::ostringstream ss;
      32         137 :     streamArguments(ss, args...);
      33         274 :     return ss.str();
      34         137 :   }
      35             : 
      36             :   template <typename... Args>
      37         137 :   explicit CapabilityException(Args &&... args) : std::runtime_error(stringify(args...))
      38             :   {
      39         137 :   }
      40             : 
      41         128 :   ~CapabilityException() throw() {}
      42             : };
      43             : 
      44             : /**
      45             :  * Exception thrown when capabilities are unknown.
      46             :  */
      47             : class UnknownCapabilitiesException : public CapabilityException
      48             : {
      49             : public:
      50             :   UnknownCapabilitiesException(const std::vector<std::string> & unknown_capabilities);
      51             : 
      52             :   /// The capabilities that are unknown
      53             :   const std::vector<std::string> unknown_capabilities;
      54             : };
      55             : }

Generated by: LCOV version 1.14