1
/** Interface for NSError for GNUStep
2
Copyright (C) 2004 Free Software Foundation, Inc.
4
Written by: Richard Frith-Macdonald <rfm@gnu.org>
7
This file is part of the GNUstep Base Library.
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Library General Public
11
License as published by the Free Software Foundation; either
12
version 2 of the License, or (at your option) any later version.
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Library General Public License for more details.
19
You should have received a copy of the GNU Library General Public
20
License along with this library; if not, write to the Free
21
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
23
AutogsdocSource: NSError.m
26
#ifndef __NSError_h_GNUSTEP_BASE_INCLUDE
27
#define __NSError_h_GNUSTEP_BASE_INCLUDE
29
#ifndef STRICT_OPENSTEP
31
#include <Foundation/NSObject.h>
33
@class NSDictionary, NSString;
36
* Key for user info dictionary component which describes the error in
37
* a human readable format.
39
GS_EXPORT NSString* const NSLocalizedDescriptionKey;
42
* Where one error has caused another, the underlying error can be stored
43
* in the user info dictionary uisng this key.
45
GS_EXPORT NSString* const NSUnderlyingErrorKey;
48
* Domain for system errors (on MACH).
50
GS_EXPORT NSString* const NSMACHErrorDomain;
52
* Domain for system errors.
54
GS_EXPORT NSString* const NSOSStatusErrorDomain;
56
* Domain for system and system library errors.
58
GS_EXPORT NSString* const NSPOSIXErrorDomain;
61
* Error information class.
63
// TODO: document what this is for, especially since it's not in OS X
64
@interface NSError : NSObject <NSCopying, NSCoding>
69
NSDictionary *_userInfo;
73
* Creates and returns an autoreleased NSError instance by calling
74
* -initWithDomain:code:userInfo:
76
+ (id) errorWithDomain: (NSString*)aDomain
78
userInfo: (NSDictionary*)aDictionary;
81
* Return the error code ... which is not globally unique, just unique for
82
* a particular domain.
87
* Return the domain for this instance.
92
* Initialises the receiver using the supplied domain, code, and info.<br />
93
* The domain must be non-nil.
95
- (id) initWithDomain: (NSString*)aDomain
97
userInfo: (NSDictionary*)aDictionary;
99
/** <override-subclass />
100
* Return a human readable description for the error.<br />
101
* The default implementation uses the value from the user info dictionary
102
* if it is available, otherwise it generates a generic one from domain
105
- (NSString *)localizedDescription;
108
* Return the user info for this instance (or nil if none is set)<br />
109
* The <code>NSLocalizedDescriptionKey</code> should locate a human readable
110
* description in the dictionary.<br />
111
* The <code>NSUnderlyingErrorKey</code> key should locate an
112
* <code>NSError</code> instance if an error is available describing any
113
* underlying problem.<br />
115
- (NSDictionary*) userInfo;
118
#endif /* STRICT_OPENSTEP */
119
#endif /* __NSError_h_GNUSTEP_BASE_INCLUDE*/