Stroika Library 3.0d25
 
Loading...
Searching...
No Matches
TimeOutException.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Execution_TimeOutException_h_
5#define _Stroika_Foundation_Execution_TimeOutException_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9_DeprecatedFile_ ("DEPRECATED TimeOutException.h - since v3.0d25 - catch (const system_error& e) and test "
10 "Execution::IsA (e, errc::timed_out); for the non-deprecated helpers that were here, use "
11 "Execution/Timeout.h and Execution/TimedLock.h");
12
13#include "Stroika/Foundation/Execution/Exceptions.h"
15#include "Stroika/Foundation/Execution/Timeout.h"
17
19
20 /**
21 * \note This entire header is DEPRECATED (Stroika v3.0d25) - the TimeOutException type and
22 * ThrowTimeOutException (), both removed at the next release-stage transition.
23 *
24 * Everything that is NOT deprecated has moved out: @see Execution/Timeout.h for how
25 * Stroika reports a timeout and for ThrowTimeoutExceptionAfter () / ThrowIfTimeout (),
26 * and @see Execution/TimedLock.h for TryLockUntil () / UniqueLock (). This file includes
27 * both, so code that included this one keeps compiling unchanged.
28 */
29 /*
30 ********************************************************************************
31 ***************************** DEPRECATED (v3.0d25) *****************************
32 ********************************************************************************
33 */
34 [[deprecated ("Since Stroika v3.0d25 - use ThrowError (errc::timed_out)")]] [[noreturn]] inline void ThrowTimeOutException ()
35 {
36 ThrowError (errc::timed_out);
37 }
38
39 DISABLE_COMPILER_MSC_WARNING_START (4996);
40 DISABLE_COMPILER_GCC_WARNING_START ("GCC diagnostic ignored \"-Wdeprecated-declarations\"");
41 DISABLE_COMPILER_CLANG_WARNING_START ("clang diagnostic ignored \"-Wdeprecated-declarations\"");
42 /**
43 * \deprecated Since Stroika v3.0d25 - catch the CONDITION instead of this type:
44 * \code
45 * catch (const system_error& e) {
46 * if (Execution::IsA (e, errc::timed_out)) { ... }
47 * }
48 * \endcode
49 * That also matches timeouts raised outside Stroika, which catching by type never did.
50 *
51 * \note Nothing throws this type: ThrowError (errc::timed_out) throws a plain SystemErrorException. So a
52 * `catch (const TimeOutException&)` never fires - its deprecation warning is the cue to replace it
53 * with the test above.
54 */
55 class [[deprecated ("Since Stroika v3.0d25 - catch (const system_error& e) and test Execution::IsA (e, errc::timed_out)")]]
57 public:
59 : TimeOutException{"Timeout Expired"sv}
60 {
61 }
62 TimeOutException (error_code ec)
63 : TimeOutException{ec, "Timeout Expired"sv}
64 {
65 }
67 : TimeOutException{make_error_code (errc::timed_out), message}
68 {
69 }
70 TimeOutException (error_code ec, const Characters::String& message)
71 : SystemErrorException{ec, message}
72 {
73 }
74
75 public:
76 static const TimeOutException kThe;
77 };
78 inline const TimeOutException TimeOutException::kThe;
79 DISABLE_COMPILER_MSC_WARNING_END (4996);
80 DISABLE_COMPILER_GCC_WARNING_END ("GCC diagnostic ignored \"-Wdeprecated-declarations\"");
81 DISABLE_COMPILER_CLANG_WARNING_END ("clang diagnostic ignored \"-Wdeprecated-declarations\"");
82
83}
84
85#endif /*_Stroika_Foundation_Execution_TimeOutException_h_*/
String is like std::u32string, except it is much easier to use, often much more space efficient,...
Definition String.h:201
void ThrowError(error_code ec)
throw a SystemErrorException with the given error_code - or std::bad_alloc for errc::not_enough_memor...