ObjFW
Loading...
Searching...
No Matches
OFException.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3 *
4 * All rights reserved.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License version 3.0 only,
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * version 3.0 for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * version 3.0 along with this program. If not, see
17 * <https://www.gnu.org/licenses/>.
18 */
19
20#import "OFObject.h"
21
22#ifdef OF_WINDOWS
23# include <windows.h>
24#endif
25
26OF_ASSUME_NONNULL_BEGIN
27
30@class OFArray OF_GENERIC(ObjectType);
31@class OFString;
32@class OFValue;
33
34#define OFStackTraceSize 16
35
36#if defined(OF_WINDOWS) && defined(OF_HAVE_SOCKETS)
37# ifndef EADDRINUSE
38# define EADDRINUSE WSAEADDRINUSE
39# endif
40# ifndef EADDRNOTAVAIL
41# define EADDRNOTAVAIL WSAEADDRNOTAVAIL
42# endif
43# ifndef EAFNOSUPPORT
44# define EAFNOSUPPORT WSAEAFNOSUPPORT
45# endif
46# ifndef EALREADY
47# define EALREADY WSAEALREADY
48# endif
49# ifndef ECONNABORTED
50# define ECONNABORTED WSAECONNABORTED
51# endif
52# ifndef ECONNREFUSED
53# define ECONNREFUSED WSAECONNREFUSED
54# endif
55# ifndef ECONNRESET
56# define ECONNRESET WSAECONNRESET
57# endif
58# ifndef EDESTADDRREQ
59# define EDESTADDRREQ WSAEDESTADDRREQ
60# endif
61# ifndef EDQUOT
62# define EDQUOT WSAEDQUOT
63# endif
64# ifndef EHOSTDOWN
65# define EHOSTDOWN WSAEHOSTDOWN
66# endif
67# ifndef EHOSTUNREACH
68# define EHOSTUNREACH WSAEHOSTUNREACH
69# endif
70# ifndef EINPROGRESS
71# define EINPROGRESS WSAEINPROGRESS
72# endif
73# ifndef EISCONN
74# define EISCONN WSAEISCONN
75# endif
76# ifndef ELOOP
77# define ELOOP WSAELOOP
78# endif
79# ifndef EMSGSIZE
80# define EMSGSIZE WSAEMSGSIZE
81# endif
82# ifndef ENETDOWN
83# define ENETDOWN WSAENETDOWN
84# endif
85# ifndef ENETRESET
86# define ENETRESET WSAENETRESET
87# endif
88# ifndef ENETUNREACH
89# define ENETUNREACH WSAENETUNREACH
90# endif
91# ifndef ENOBUFS
92# define ENOBUFS WSAENOBUFS
93# endif
94# ifndef ENOPROTOOPT
95# define ENOPROTOOPT WSAENOPROTOOPT
96# endif
97# ifndef ENOTCONN
98# define ENOTCONN WSAENOTCONN
99# endif
100# ifndef ENOTSOCK
101# define ENOTSOCK WSAENOTSOCK
102# endif
103# ifndef EOPNOTSUPP
104# define EOPNOTSUPP WSAEOPNOTSUPP
105# endif
106# ifndef EPFNOSUPPORT
107# define EPFNOSUPPORT WSAEPFNOSUPPORT
108# endif
109# ifndef EPROCLIM
110# define EPROCLIM WSAEPROCLIM
111# endif
112# ifndef EPROTONOSUPPORT
113# define EPROTONOSUPPORT WSAEPROTONOSUPPORT
114# endif
115# ifndef EPROTOTYPE
116# define EPROTOTYPE WSAEPROTOTYPE
117# endif
118# ifndef EREMOTE
119# define EREMOTE WSAEREMOTE
120# endif
121# ifndef ESHUTDOWN
122# define ESHUTDOWN WSAESHUTDOWN
123# endif
124# ifndef ESOCKTNOSUPPORT
125# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
126# endif
127# ifndef ESTALE
128# define ESTALE WSAESTALE
129# endif
130# ifndef ETIMEDOUT
131# define ETIMEDOUT WSAETIMEDOUT
132# endif
133# ifndef ETOOMANYREFS
134# define ETOOMANYREFS WSAETOOMANYREFS
135# endif
136# ifndef EUSERS
137# define EUSERS WSAEUSERS
138# endif
139# ifndef EWOULDBLOCK
140# define EWOULDBLOCK WSAEWOULDBLOCK
141# endif
142#endif
143
144#ifndef EWOULDBLOCK
145# define EWOULDBLOCK EAGAIN
146#endif
147
157{
158 void *_stackTrace[OFStackTraceSize];
159 OF_RESERVE_IVARS(OFException, 4)
160}
161
167+ (instancetype)exception;
168
174- (OFString *)description;
175
183- (nullable OFArray OF_GENERIC(OFValue *) *)stackTraceAddresses;
184
191- (nullable OFArray OF_GENERIC(OFString *) *)stackTraceSymbols;
192@end
193
194#ifdef __cplusplus
195extern "C" {
196#endif
208extern OFString *OFStrError(int errNo);
209
210#ifdef OF_WINDOWS
211extern OFString *_OFWindowsStatusToString(LSTATUS status) OF_VISIBILITY_HIDDEN;
212#endif
213#ifdef __cplusplus
214}
215#endif
216
217OF_ASSUME_NONNULL_END
OFString * OFStrError(int errNo)
Converts the specified error number (from <errno.h>) to a string.
Definition OFException.m:90
An abstract class for storing objects in an array.
Definition OFArray.h:109
The base class for all exceptions in ObjFW.
Definition OFException.h:157
The root class for all other classes inside ObjFW.
Definition OFObject.h:692
A class for handling strings.
Definition OFString.h:143
A class for storing arbitrary values in an object.
Definition OFValue.h:29