2017-02-01 16:21:50 +01:00
|
|
|
//
|
|
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
2016-08-26 16:01:53 +02:00
|
|
|
|
|
|
|
#import "OWSError.h"
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
NSString *const OWSSignalServiceKitErrorDomain = @"OWSSignalServiceKitErrorDomain";
|
|
|
|
|
2016-08-29 23:03:24 +02:00
|
|
|
NSError *OWSErrorWithCodeDescription(OWSErrorCode code, NSString *description)
|
2016-08-26 16:01:53 +02:00
|
|
|
{
|
|
|
|
return [NSError errorWithDomain:OWSSignalServiceKitErrorDomain
|
|
|
|
code:code
|
|
|
|
userInfo:@{ NSLocalizedDescriptionKey: description }];
|
|
|
|
}
|
|
|
|
|
2016-10-14 23:00:29 +02:00
|
|
|
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."));
|
|
|
|
}
|
|
|
|
|
2016-10-25 15:54:43 +02:00
|
|
|
NSError *OWSErrorMakeNoSuchSignalRecipientError()
|
|
|
|
{
|
2017-02-02 01:18:28 +01:00
|
|
|
return OWSErrorWithCodeDescription(OWSErrorCodeNoSuchSignalRecipient,
|
2016-10-25 15:54:43 +02:00
|
|
|
NSLocalizedString(
|
|
|
|
@"ERROR_DESCRIPTION_UNREGISTERED_RECIPIENT", @"Error message when attempting to send message"));
|
|
|
|
}
|
|
|
|
|
2016-12-18 22:08:26 +01:00
|
|
|
NSError *OWSErrorMakeAssertionError()
|
|
|
|
{
|
|
|
|
return OWSErrorWithCodeDescription(OWSErrorCodeFailedToSendOutgoingMessage,
|
2017-02-01 16:21:50 +01:00
|
|
|
NSLocalizedString(@"ERROR_DESCRIPTION_UNKNOWN_ERROR", @"Worst case generic error message"));
|
|
|
|
}
|
|
|
|
|
2017-02-10 19:20:11 +01:00
|
|
|
NSError *OWSErrorMakeMessageSendDisabledDueToPreKeyUpdateFailuresError()
|
|
|
|
{
|
|
|
|
return OWSErrorWithCodeDescription(OWSErrorCodeMessageSendDisabledDueToPreKeyUpdateFailures,
|
|
|
|
NSLocalizedString(@"ERROR_DESCRIPTION_MESSAGE_SEND_DISABLED_PREKEY_UPDATE_FAILURES",
|
|
|
|
@"Error mesage indicating that message send is disabled due to prekey update failures"));
|
|
|
|
}
|
|
|
|
|
2016-08-26 16:01:53 +02:00
|
|
|
NS_ASSUME_NONNULL_END
|