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
     1 //
     2 //  NSError+PEP.m
     3 //  pEpObjCAdapter
     4 //
     5 //  Created by Dirk Zimmermann on 20.02.18.
     6 //  Copyright © 2018 p≡p. All rights reserved.
     7 //
     8 
     9 #import "NSError+PEP.h"
    10 
    11 @implementation NSError (Extension)
    12 
    13 + (NSError *)errorWithPEPStatus:(PEP_STATUS)status
    14                        userInfo:(NSDictionary<NSErrorUserInfoKey, id> *)dict
    15 {
    16     if (status != PEP_STATUS_OK) {
    17         return [NSError errorWithDomain:@"pEp" code:status userInfo:dict];
    18     }
    19     return nil;
    20 }
    21 
    22 + (NSError *)errorWithPEPStatus:(PEP_STATUS)status
    23 {
    24     return [self errorWithPEPStatus:status userInfo:nil];
    25 }
    26 
    27 @end