mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.8 KiB
Objective-C
50 lines
1.8 KiB
Objective-C
//
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "OWSError.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
NSString *const OWSSignalServiceKitErrorDomain = @"OWSSignalServiceKitErrorDomain";
|
|
|
|
NSError *OWSErrorWithCodeDescription(OWSErrorCode code, NSString *description)
|
|
{
|
|
return [NSError errorWithDomain:OWSSignalServiceKitErrorDomain
|
|
code:code
|
|
userInfo:@{ NSLocalizedDescriptionKey: description }];
|
|
}
|
|
|
|
NSError *OWSErrorMakeUnableToProcessServerResponseError()
|
|
{
|
|
return OWSErrorWithCodeDescription(OWSErrorCodeUnableToProcessServerResponse,
|
|
NSLocalizedString(@"ERROR_DESCRIPTION_SERVER_FAILURE", @"Generic server error"));
|
|
}
|
|
|
|
NSError *OWSErrorMakeFailedToSendOutgoingMessageError()
|
|
{
|
|
return OWSErrorWithCodeDescription(OWSErrorCodeFailedToSendOutgoingMessage,
|
|
NSLocalizedString(@"ERROR_DESCRIPTION_CLIENT_SENDING_FAILURE", @"Generic notice when message failed to send."));
|
|
}
|
|
|
|
NSError *OWSErrorMakeNoSuchSignalRecipientError()
|
|
{
|
|
return OWSErrorWithCodeDescription(OWSErrorCodeFailedToSendOutgoingMessage,
|
|
NSLocalizedString(
|
|
@"ERROR_DESCRIPTION_UNREGISTERED_RECIPIENT", @"Error message when attempting to send message"));
|
|
}
|
|
|
|
NSError *OWSErrorMakeAssertionError()
|
|
{
|
|
return OWSErrorWithCodeDescription(OWSErrorCodeFailedToSendOutgoingMessage,
|
|
NSLocalizedString(@"ERROR_DESCRIPTION_UNKNOWN_ERROR", @"Worst case generic error message"));
|
|
}
|
|
|
|
NSError *OWSErrorMakeWebRTCMissingDataChannelError()
|
|
{
|
|
return OWSErrorWithCodeDescription(OWSErrorCodeWebRTCMissingDataChannel,
|
|
NSLocalizedString(@"ERROR_DESCRIPTION_WEBRTC_MISSING_DATA_CHANNEL", @"Missing data channel while trying to sending message"));
|
|
}
|
|
|
|
NS_ASSUME_NONNULL_END
|