Webthing-CPP: a modern CPP implementation of the WebThings API


LCOV - code coverage report
Current view: top level - webthing - errors.hpp (source / functions) Coverage Total Hit
Test: filtered_coverage.info Lines: 100.0 % 12 12
Test Date: 2025-03-15 12:45:00 Functions: 100.0 % 4 4

            Line data    Source code
       1              : // Webthing-CPP
       2              : // SPDX-FileCopyrightText: 2023-present Benno Waldhauer
       3              : // SPDX-License-Identifier: MIT
       4              : 
       5              : #pragma once
       6              : 
       7              : #include <stdexcept>
       8              : 
       9              : namespace bw::webthing {
      10              : 
      11              : class InvalidJson : public std::runtime_error
      12              : {
      13              : public:
      14              :     InvalidJson()
      15              :         : std::runtime_error("General json validation error")
      16              :     {}
      17              : 
      18           15 :     InvalidJson(std::string message)
      19           15 :         : std::runtime_error(message)
      20           15 :     {}  
      21              : };
      22              : 
      23              : class PropertyError : public std::runtime_error
      24              : {
      25              : public:
      26              :     PropertyError()
      27              :         : std::runtime_error("General property error")
      28              :     {}
      29              : 
      30           13 :     PropertyError(std::string message)
      31           13 :         : std::runtime_error(message)
      32           13 :     {}  
      33              : };
      34              : 
      35              : class ActionError : public std::runtime_error
      36              : {
      37              : public:
      38              :     ActionError()
      39              :         : std::runtime_error("General action error")
      40              :     {}
      41              : 
      42            5 :     ActionError(std::string message)
      43            5 :         : std::runtime_error(message)
      44            5 :     {}  
      45              : };
      46              : 
      47              : class EventError : public std::runtime_error
      48              : {
      49              : public:
      50              :     EventError()
      51              :         : std::runtime_error("General event error")
      52              :     {}
      53              : 
      54            1 :     EventError(std::string message)
      55            1 :         : std::runtime_error(message)
      56            1 :     {}  
      57              : };
      58              : 
      59              : } // bw::webthing
        

Generated by: LCOV version 2.0-1