ObjFW
OFException.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFObject.h"
18 
19 @class OFString;
20 #ifndef DOXYGEN
21 @class OFArray OF_GENERIC(ObjectType);
22 @class OFMutableArray OF_GENERIC(ObjectType);
23 #endif
24 
25 #define OF_BACKTRACE_SIZE 32
26 
27 #if defined(_WIN32) && defined(OF_HAVE_SOCKETS)
28 # ifndef EADDRINUSE
29 # define EADDRINUSE WSAEADDRINUSE
30 # endif
31 # ifndef EADDRNOTAVAIL
32 # define EADDRNOTAVAIL WSAEADDRNOTAVAIL
33 # endif
34 # ifndef EAFNOSUPPORT
35 # define EAFNOSUPPORT WSAEAFNOSUPPORT
36 # endif
37 # ifndef EALREADY
38 # define EALREADY WSAEALREADY
39 # endif
40 # ifndef ECONNABORTED
41 # define ECONNABORTED WSAECONNABORTED
42 # endif
43 # ifndef ECONNREFUSED
44 # define ECONNREFUSED WSAECONNREFUSED
45 # endif
46 # ifndef ECONNRESET
47 # define ECONNRESET WSAECONNRESET
48 # endif
49 # ifndef EDESTADDRREQ
50 # define EDESTADDRREQ WSAEDESTADDRREQ
51 # endif
52 # ifndef EDQUOT
53 # define EDQUOT WSAEDQUOT
54 # endif
55 # ifndef EHOSTDOWN
56 # define EHOSTDOWN WSAEHOSTDOWN
57 # endif
58 # ifndef EHOSTUNREACH
59 # define EHOSTUNREACH WSAEHOSTUNREACH
60 # endif
61 # ifndef EINPROGRESS
62 # define EINPROGRESS WSAEINPROGRESS
63 # endif
64 # ifndef EISCONN
65 # define EISCONN WSAEISCONN
66 # endif
67 # ifndef ELOOP
68 # define ELOOP WSAELOOP
69 # endif
70 # ifndef EMSGSIZE
71 # define EMSGSIZE WSAEMSGSIZE
72 # endif
73 # ifndef ENETDOWN
74 # define ENETDOWN WSAENETDOWN
75 # endif
76 # ifndef ENETRESET
77 # define ENETRESET WSAENETRESET
78 # endif
79 # ifndef ENETUNREACH
80 # define ENETUNREACH WSAENETUNREACH
81 # endif
82 # ifndef ENOBUFS
83 # define ENOBUFS WSAENOBUFS
84 # endif
85 # ifndef ENOPROTOOPT
86 # define ENOPROTOOPT WSAENOPROTOOPT
87 # endif
88 # ifndef ENOTCONN
89 # define ENOTCONN WSAENOTCONN
90 # endif
91 # ifndef ENOTSOCK
92 # define ENOTSOCK WSAENOTSOCK
93 # endif
94 # ifndef EOPNOTSUPP
95 # define EOPNOTSUPP WSAEOPNOTSUPP
96 # endif
97 # ifndef EPFNOSUPPORT
98 # define EPFNOSUPPORT WSAEPFNOSUPPORT
99 # endif
100 # ifndef EPROCLIM
101 # define EPROCLIM WSAEPROCLIM
102 # endif
103 # ifndef EPROTONOSUPPORT
104 # define EPROTONOSUPPORT WSAEPROTONOSUPPORT
105 # endif
106 # ifndef EPROTOTYPE
107 # define EPROTOTYPE WSAEPROTOTYPE
108 # endif
109 # ifndef EREMOTE
110 # define EREMOTE WSAEREMOTE
111 # endif
112 # ifndef ESHUTDOWN
113 # define ESHUTDOWN WSAESHUTDOWN
114 # endif
115 # ifndef ESOCKTNOSUPPORT
116 # define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
117 # endif
118 # ifndef ESTALE
119 # define ESTALE WSAESTALE
120 # endif
121 # ifndef ETIMEDOUT
122 # define ETIMEDOUT WSAETIMEDOUT
123 # endif
124 # ifndef ETOOMANYREFS
125 # define ETOOMANYREFS WSAETOOMANYREFS
126 # endif
127 # ifndef EUSERS
128 # define EUSERS WSAEUSERS
129 # endif
130 # ifndef EWOULDBLOCK
131 # define EWOULDBLOCK WSAEWOULDBLOCK
132 # endif
133 extern int of_wsaerr_to_errno(int);
134 #endif
135 
145 {
146  void *_backtrace[OF_BACKTRACE_SIZE];
147 }
148 
154 + (instancetype)exception;
155 
161 - (OFString*)description;
162 
169 - (OFArray*)backtrace;
170 @end
171 
172 #ifdef __cplusplus
173 extern "C" {
174 #endif
175 extern OFString* of_strerror(int errNo);
176 #ifdef __cplusplus
177 }
178 #endif
An abstract class for storing objects in an array.
Definition: OFArray.h:95
The root class for all other classes inside ObjFW.
Definition: OFObject.h:364
An abstract class for storing, adding and removing objects in an array.
Definition: OFMutableArray.h:46
A class for handling strings.
Definition: OFString.h:91
The base class for all exceptions in ObjFW.
Definition: OFException.h:144