ObjFW
Loading...
Searching...
No Matches
OFException.h
1/*
2 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3 *
4 * All rights reserved.
5 *
6 * This file is part of ObjFW. It may be distributed under the terms of the
7 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8 * the packaging of this file.
9 *
10 * Alternatively, it may be distributed under the terms of the GNU General
11 * Public License, either version 2 or 3, which can be found in the file
12 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13 * file.
14 */
15
16#import "OFObject.h"
17
18#ifdef OF_WINDOWS
19# include <windows.h>
20#endif
21
22OF_ASSUME_NONNULL_BEGIN
23
24@class OFArray OF_GENERIC(ObjectType);
25@class OFString;
26@class OFValue;
27
28#define OFStackTraceSize 16
29
30#if defined(OF_WINDOWS) && defined(OF_HAVE_SOCKETS)
31# ifndef EADDRINUSE
32# define EADDRINUSE WSAEADDRINUSE
33# endif
34# ifndef EADDRNOTAVAIL
35# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
36# endif
37# ifndef EAFNOSUPPORT
38# define EAFNOSUPPORT WSAEAFNOSUPPORT
39# endif
40# ifndef EALREADY
41# define EALREADY WSAEALREADY
42# endif
43# ifndef ECONNABORTED
44# define ECONNABORTED WSAECONNABORTED
45# endif
46# ifndef ECONNREFUSED
47# define ECONNREFUSED WSAECONNREFUSED
48# endif
49# ifndef ECONNRESET
50# define ECONNRESET WSAECONNRESET
51# endif
52# ifndef EDESTADDRREQ
53# define EDESTADDRREQ WSAEDESTADDRREQ
54# endif
55# ifndef EDQUOT
56# define EDQUOT WSAEDQUOT
57# endif
58# ifndef EHOSTDOWN
59# define EHOSTDOWN WSAEHOSTDOWN
60# endif
61# ifndef EHOSTUNREACH
62# define EHOSTUNREACH WSAEHOSTUNREACH
63# endif
64# ifndef EINPROGRESS
65# define EINPROGRESS WSAEINPROGRESS
66# endif
67# ifndef EISCONN
68# define EISCONN WSAEISCONN
69# endif
70# ifndef ELOOP
71# define ELOOP WSAELOOP
72# endif
73# ifndef EMSGSIZE
74# define EMSGSIZE WSAEMSGSIZE
75# endif
76# ifndef ENETDOWN
77# define ENETDOWN WSAENETDOWN
78# endif
79# ifndef ENETRESET
80# define ENETRESET WSAENETRESET
81# endif
82# ifndef ENETUNREACH
83# define ENETUNREACH WSAENETUNREACH
84# endif
85# ifndef ENOBUFS
86# define ENOBUFS WSAENOBUFS
87# endif
88# ifndef ENOPROTOOPT
89# define ENOPROTOOPT WSAENOPROTOOPT
90# endif
91# ifndef ENOTCONN
92# define ENOTCONN WSAENOTCONN
93# endif
94# ifndef ENOTSOCK
95# define ENOTSOCK WSAENOTSOCK
96# endif
97# ifndef EOPNOTSUPP
98# define EOPNOTSUPP WSAEOPNOTSUPP
99# endif
100# ifndef EPFNOSUPPORT
101# define EPFNOSUPPORT WSAEPFNOSUPPORT
102# endif
103# ifndef EPROCLIM
104# define EPROCLIM WSAEPROCLIM
105# endif
106# ifndef EPROTONOSUPPORT
107# define EPROTONOSUPPORT WSAEPROTONOSUPPORT
108# endif
109# ifndef EPROTOTYPE
110# define EPROTOTYPE WSAEPROTOTYPE
111# endif
112# ifndef EREMOTE
113# define EREMOTE WSAEREMOTE
114# endif
115# ifndef ESHUTDOWN
116# define ESHUTDOWN WSAESHUTDOWN
117# endif
118# ifndef ESOCKTNOSUPPORT
119# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
120# endif
121# ifndef ESTALE
122# define ESTALE WSAESTALE
123# endif
124# ifndef ETIMEDOUT
125# define ETIMEDOUT WSAETIMEDOUT
126# endif
127# ifndef ETOOMANYREFS
128# define ETOOMANYREFS WSAETOOMANYREFS
129# endif
130# ifndef EUSERS
131# define EUSERS WSAEUSERS
132# endif
133# ifndef EWOULDBLOCK
134# define EWOULDBLOCK WSAEWOULDBLOCK
135# endif
136#endif
137
138#ifndef EWOULDBLOCK
139# define EWOULDBLOCK EAGAIN
140#endif
141
151{
152 void *_stackTrace[OFStackTraceSize];
153 OF_RESERVE_IVARS(OFException, 4)
154}
155
161+ (instancetype)exception;
162
168- (OFString *)description;
169
177- (nullable OFArray OF_GENERIC(OFValue *) *)stackTraceAddresses;
178
185- (nullable OFArray OF_GENERIC(OFString *) *)stackTraceSymbols;
186@end
187
188#ifdef __cplusplus
189extern "C" {
190#endif
191extern OFString *OFStrError(int errNo);
192#ifdef OF_WINDOWS
193extern OFString *OFWindowsStatusToString(LSTATUS status);
194#endif
195#ifdef __cplusplus
196}
197#endif
198
199OF_ASSUME_NONNULL_END
An abstract class for storing objects in an array.
Definition OFArray.h:105
The base class for all exceptions in ObjFW.
Definition OFException.h:151
The root class for all other classes inside ObjFW.
Definition OFObject.h:688
A class for handling strings.
Definition OFString.h:135
A class for storing arbitrary values in an object.
Definition OFValue.h:25