pEpObjCAdapter/NSError+PEP.m
author Dirk Zimmermann <dirk@pep-project.org>
Tue, 20 Feb 2018 15:38:32 +0100
changeset 483 291ca596a013
child 507 5380181d09a5
permissions -rw-r--r--
IOSAD-76 NSError+PEP
dirk@483
     1
//
dirk@483
     2
//  NSError+PEP.m
dirk@483
     3
//  pEpObjCAdapter
dirk@483
     4
//
dirk@483
     5
//  Created by Dirk Zimmermann on 20.02.18.
dirk@483
     6
//  Copyright © 2018 p≡p. All rights reserved.
dirk@483
     7
//
dirk@483
     8
dirk@483
     9
#import "NSError+PEP.h"
dirk@483
    10
dirk@483
    11
@implementation NSError (Extension)
dirk@483
    12
dirk@483
    13
+ (NSError *)errorWithPEPStatus:(PEP_STATUS)status
dirk@483
    14
                       userInfo:(NSDictionary<NSErrorUserInfoKey, id> *)dict
dirk@483
    15
{
dirk@483
    16
    if (status != PEP_STATUS_OK) {
dirk@483
    17
        return [NSError errorWithDomain:@"pEp" code:status userInfo:dict];
dirk@483
    18
    }
dirk@483
    19
    return nil;
dirk@483
    20
}
dirk@483
    21
dirk@483
    22
+ (NSError *)errorWithPEPStatus:(PEP_STATUS)status
dirk@483
    23
{
dirk@483
    24
    return [self errorWithPEPStatus:status userInfo:nil];
dirk@483
    25
}
dirk@483
    26
dirk@483
    27
@end