]> git.saurik.com Git - apple/security.git/blob - KeychainCircle/NSError+KCCreationHelpers.h
Security-58286.270.3.0.1.tar.gz
[apple/security.git] / KeychainCircle / NSError+KCCreationHelpers.h
1 //
2 // NSError+KCCreationHelpers.h
3 // KeychainCircle
4 //
5 //
6
7 #import <Foundation/Foundation.h>
8
9 NS_ASSUME_NONNULL_BEGIN
10
11 // Returns false and fills in error with formatted description if cc_result is an error
12 bool CoreCryptoError(int cc_result, NSError * _Nullable * _Nullable error, NSString * _Nonnull description, ...) NS_FORMAT_FUNCTION(3, 4);
13 // Returns false and fills in a requirement error if requirement is false
14 // We should have something better than -50 here.
15 bool RequirementError(bool requirement, NSError * _Nullable * _Nullable error, NSString * _Nonnull description, ...) NS_FORMAT_FUNCTION(3, 4);
16
17 bool OSStatusError(OSStatus status, NSError * _Nullable * _Nullable error, NSString* _Nonnull description, ...) NS_FORMAT_FUNCTION(3, 4);
18
19
20 // MARK: Error Extensions
21 @interface NSError(KCCreationHelpers)
22
23 + (instancetype) errorWithOSStatus:(OSStatus) status
24 userInfo:(NSDictionary *)dict;
25
26 - (instancetype) initWithOSStatus:(OSStatus) status
27 userInfo:(NSDictionary *)dict;
28
29 + (instancetype) errorWithOSStatus:(OSStatus) status
30 description:(NSString*)description
31 args:(va_list)va NS_FORMAT_FUNCTION(2, 0);
32
33 - (instancetype) initWithOSStatus:(OSStatus) status
34 description:(NSString*)description
35 args:(va_list)va NS_FORMAT_FUNCTION(2, 0);
36
37 + (instancetype) errorWithCoreCryptoStatus:(int) status
38 userInfo:(NSDictionary *)dict;
39
40 - (instancetype) initWithCoreCryptoStatus:(int) status
41 userInfo:(NSDictionary *)dict;
42
43 + (instancetype) errorWithCoreCryptoStatus:(int) status
44 description:(NSString*)description
45 args:(va_list)va NS_FORMAT_FUNCTION(2, 0);
46
47 - (instancetype) initWithCoreCryptoStatus:(int) status
48 description:(NSString*)description
49 args:(va_list)va NS_FORMAT_FUNCTION(2, 0);
50
51 @end
52
53 NS_ASSUME_NONNULL_END