summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLError.h
blob: 622da44b037f49466a146b3666b9a0b40c51ecf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//
//  SDLErrorConstants.h
//  SmartDeviceLink-iOS
//
//  Created by Joel Fischer on 10/5/15.
//  Copyright © 2015 smartdevicelink. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "SDLErrorConstants.h"

#import "SDLResult.h"


NS_ASSUME_NONNULL_BEGIN

#pragma mark Error Domains
typedef NSString SDLErrorDomain;
extern SDLErrorDomain *const SDLErrorDomainLifecycleManager;
extern SDLErrorDomain *const SDLErrorDomainFileManager;
extern SDLErrorDomain *const SDLErrorDomainTextAndGraphicManager;
extern SDLErrorDomain *const SDLErrorDomainSoftButtonManager;
extern SDLErrorDomain *const SDLErrorDomainMenuManager;
extern SDLErrorDomain *const SDLErrorDomainChoiceSetManager;
extern SDLErrorDomain *const SDLErrorDomainSystemCapabilityManager;
extern SDLErrorDomain *const SDLErrorDomainTransport;
extern SDLErrorDomain *const SDLErrorDomainRPCStore;
extern SDLErrorDomain *const SDLErrorDomainCacheFileManager;
extern SDLErrorDomain *const SDLErrorDomainAudioStreamManager;


@interface NSError (SDLErrors)

#pragma mark SDLEncryptionLifecycleManager
+ (NSError *)sdl_encryption_lifecycle_notReadyError;
+ (NSError *)sdl_encryption_lifecycle_encryption_off;
+ (NSError *)sdl_encryption_lifecycle_nak;

#pragma mark SDLManager

+ (NSError *)sdl_lifecycle_rpcErrorWithDescription:(nullable NSString *)description andReason:(nullable NSString *)reason;
+ (NSError *)sdl_lifecycle_notConnectedError;
+ (NSError *)sdl_lifecycle_notReadyError;
+ (NSError *)sdl_lifecycle_unknownRemoteErrorWithDescription:(nullable NSString *)description andReason:(nullable NSString *)reason;
+ (NSError *)sdl_lifecycle_managersFailedToStart;
+ (NSError *)sdl_lifecycle_startedWithBadResult:(nullable SDLResult)result info:(nullable NSString *)info;
+ (NSError *)sdl_lifecycle_startedWithWarning:(nullable SDLResult)result info:(nullable NSString *)info;
+ (NSError *)sdl_lifecycle_failedWithBadResult:(nullable SDLResult)result info:(nullable NSString *)info;
+ (NSError *)sdl_lifecycle_multipleRequestsCancelled;

#pragma mark SDLFileManager

+ (NSError *)sdl_fileManager_cannotOverwriteError;
+ (NSError *)sdl_fileManager_noKnownFileError;
+ (NSError *)sdl_fileManager_unableToStartError;
+ (NSError *)sdl_fileManager_unableToUploadError;
+ (NSError *)sdl_fileManager_unableToUpload_ErrorWithUserInfo:(NSDictionary *)userInfo;
+ (NSError *)sdl_fileManager_unableToDelete_ErrorWithUserInfo:(NSDictionary *)userInfo;
+ (NSError *)sdl_fileManager_fileDoesNotExistError;
+ (NSError *)sdl_fileManager_fileUploadCanceled;
+ (NSError *)sdl_fileManager_dataMissingError;
+ (NSError *)sdl_fileManager_staticIconError;

#pragma mark Screen Managers

+ (NSError *)sdl_softButtonManager_pendingUpdateSuperseded;
+ (NSError *)sdl_subscribeButtonManager_notSubscribed;
+ (NSError *)sdl_textAndGraphicManager_pendingUpdateSuperseded;

#pragma mark Menu Manager

+ (NSError *)sdl_menuManager_failedToUpdateWithDictionary:(NSDictionary *)userInfo;

#pragma mark Choice Set Manager

+ (NSError *)sdl_choiceSetManager_choicesDeletedBeforePresentation:(NSDictionary *)userInfo;
+ (NSError *)sdl_choiceSetManager_choiceDeletionFailed:(NSDictionary *)userInfo;
+ (NSError *)sdl_choiceSetManager_choiceUploadFailed:(NSDictionary *)userInfo;
+ (NSError *)sdl_choiceSetManager_failedToCreateMenuItems;
+ (NSError *)sdl_choiceSetManager_incorrectState:(NSString *)state;


#pragma mark System Capability Manager

+ (NSError *)sdl_systemCapabilityManager_moduleDoesNotSupportSystemCapabilities;
+ (NSError *)sdl_systemCapabilityManager_cannotUpdateInHMINONE;
+ (NSError *)sdl_systemCapabilityManager_cannotUpdateTypeDISPLAYS;

#pragma mark Transport

+ (NSError *)sdl_transport_unknownError;
+ (NSError *)sdl_transport_connectionRefusedError;
+ (NSError *)sdl_transport_connectionTimedOutError;
+ (NSError *)sdl_transport_networkDownError;

#pragma mark Store

+ (NSError *)sdl_rpcStore_invalidObjectErrorWithObject:(id)wrongObject expectedType:(Class)type;

#pragma mark Cache File Manager

+ (NSError *)sdl_cacheFileManager_updateIconArchiveFileFailed;

#pragma mark Audio Stream Manager

+ (NSError *)sdl_audioStreamManager_notConnected;

@end

@interface NSException (SDLExceptions)

+ (NSException *)sdl_missingHandlerException;
+ (NSException *)sdl_missingIdException;
+ (NSException *)sdl_missingFilesException;
+ (NSException *)sdl_invalidSoftButtonStateException;
+ (NSException *)sdl_carWindowOrientationException;
+ (NSException *)sdl_invalidLockscreenSetupException;
+ (NSException *)sdl_invalidSystemCapabilitySelectorExceptionWithSelector:(SEL)selector;
+ (NSException *)sdl_invalidSubscribeButtonSelectorExceptionWithSelector:(SEL)selector;

@end

NS_ASSUME_NONNULL_END