diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-11-07 10:37:53 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-11-07 10:37:53 +0100 |
commit | f7507aea98b1a428d02fe5c41d25ee69dd5436bb (patch) | |
tree | 49f9349a1d7441874d1cb6d4428e2bcb0d63b422 /common/rfb/Exception.h | |
parent | 7508e9887de022e127d8fadb9f6a6bd8e9778864 (diff) | |
parent | 2b7857283b834391266e414adcff8c20f8fe3067 (diff) | |
download | tigervnc-f7507aea98b1a428d02fe5c41d25ee69dd5436bb.tar.gz tigervnc-f7507aea98b1a428d02fe5c41d25ee69dd5436bb.zip |
Merge branch 'stdexcept' of github.com:CendioOssman/tigervnc
Diffstat (limited to 'common/rfb/Exception.h')
-rw-r--r-- | common/rfb/Exception.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/common/rfb/Exception.h b/common/rfb/Exception.h index 773c65fa..0e74209c 100644 --- a/common/rfb/Exception.h +++ b/common/rfb/Exception.h @@ -1,4 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright 2014-2024 Pierre Ossman for Cendio AB * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,17 +19,25 @@ #ifndef __RFB_EXCEPTION_H__ #define __RFB_EXCEPTION_H__ -#include <rdr/Exception.h> +#include <stdexcept> namespace rfb { - typedef rdr::Exception Exception; - struct AuthFailureException : public Exception { - AuthFailureException(const char* reason) - : Exception("%s", reason) {} + class protocol_error : public std::runtime_error { + public: + protocol_error(const char* what_arg) : std::runtime_error(what_arg) {} + protocol_error(const std::string& what_arg) : std::runtime_error(what_arg) {} }; - struct AuthCancelledException : public rfb::Exception { - AuthCancelledException() - : Exception("Authentication cancelled") {} + + class auth_error : public std::runtime_error { + public: + auth_error(const char* reason) : std::runtime_error(reason) {} + auth_error(std::string& reason) : std::runtime_error(reason) {} + }; + + class auth_cancelled : public std::runtime_error { + public: + auth_cancelled() + : std::runtime_error("Authentication cancelled") {} }; } #endif |