Botan 3.6.1
Crypto and TLS for C&
tls_exceptn.h
Go to the documentation of this file.
1/*
2* Exceptions
3* (C) 2004-2006 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_TLS_EXCEPTION_H_
9#define BOTAN_TLS_EXCEPTION_H_
10
11#include <botan/exceptn.h>
12#include <botan/tls_alert.h>
13
14namespace Botan::TLS {
15
16/**
17* TLS Exception Base Class
18*/
20 public:
21 Alert::Type type() const { return m_alert_type; }
22
23 TLS_Exception(Alert::Type type, std::string_view err_msg = "Unknown error") :
24 Exception(err_msg), m_alert_type(type) {}
25
26 int error_code() const noexcept override { return static_cast<int>(m_alert_type); }
27
28 ErrorType error_type() const noexcept override { return ErrorType::TLSError; }
29
30 private:
31 Alert::Type m_alert_type;
32};
33
34/**
35* Unexpected_Message Exception
36*/
38 public:
39 explicit Unexpected_Message(std::string_view err) : TLS_Exception(AlertType::UnexpectedMessage, err) {}
40};
41
42} // namespace Botan::TLS
43
44#endif
Alert::Type type() const
Definition tls_exceptn.h:21
ErrorType error_type() const noexcept override
Definition tls_exceptn.h:28
int error_code() const noexcept override
Definition tls_exceptn.h:26
TLS_Exception(Alert::Type type, std::string_view err_msg="Unknown error")
Definition tls_exceptn.h:23
Unexpected_Message(std::string_view err)
Definition tls_exceptn.h:39
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition compiler.h:31
ErrorType
Definition exceptn.h:20