CSException.h 920 Bytes
//
//  CSException.h
//  CocoaSettings
//
//  Created by Yunpeng Li on 2019/8/16.
//

#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN

extern NSExceptionName const CSExceptionNameIllegalAlias;
extern NSExceptionName const CSExceptionNameIllegalType;
extern NSExceptionName const CSExceptionNameIllegalData;
extern NSExceptionName const CSExceptionNameUnknownDataLayerIdentifier;
extern NSExceptionName const CSExceptionNameIllegalSettingsClass;
extern NSExceptionName const CSExceptionNamePersistenceFailed;
extern NSExceptionName const CSExceptionNameReadFileFailed;
extern NSExceptionName const CSExceptionNameDuplicateRegister;

#define CSThrow(EXCEPTION_NAME, REASON, ...) [CSException throw:(EXCEPTION_NAME) reason: ([NSString stringWithFormat: REASON, ##__VA_ARGS__])]

@interface CSException : NSObject
+ (void)throw:(NSExceptionName)name reason:(nullable NSString *)reason;
@end

NS_ASSUME_NONNULL_END