MYErrorUtils.m
changeset 24 629c7605ab2a
parent 22 a9da6c5d3f7c
child 25 47d10ac2d04e
     1.1 --- a/MYErrorUtils.m	Sat Apr 04 20:53:53 2009 -0700
     1.2 +++ b/MYErrorUtils.m	Wed Apr 08 16:31:19 2009 -0700
     1.3 @@ -10,6 +10,7 @@
     1.4  #import "Test.h"
     1.5  #import "CollectionUtils.h"
     1.6  #import <Foundation/Foundation.h>
     1.7 +#import <Security/SecBase.h>
     1.8  
     1.9  
    1.10  NSString* const MYErrorDomain = @"MYErrorDomain";
    1.11 @@ -39,6 +40,22 @@
    1.12  }
    1.13  
    1.14  
    1.15 +BOOL MYReturnError( NSError **outError,
    1.16 +                    int errorCode, NSString *domain, NSString *messageFormat, ... ) 
    1.17 +{
    1.18 +    if (errorCode) {
    1.19 +        if (outError) {
    1.20 +            va_list args;
    1.21 +            va_start(args,messageFormat);
    1.22 +            *outError = MYMakeErrorV(errorCode, domain, messageFormat, args);
    1.23 +            va_end(args);
    1.24 +        }
    1.25 +        return NO;
    1.26 +    } else
    1.27 +        return YES;
    1.28 +}
    1.29 +
    1.30 +
    1.31  BOOL MYMiscError( NSError **error, NSString *message, ... )
    1.32  {
    1.33      if (error) {
    1.34 @@ -106,7 +123,7 @@
    1.35                  result = nil;
    1.36          }
    1.37      } 
    1.38 -#if !TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
    1.39 +#if !TARGET_OS_IPHONE || defined(__SEC_TYPES__)
    1.40      else if ($equal(domain,NSOSStatusErrorDomain)) {
    1.41          // If it's an OSStatus, check whether CarbonCore knows its name:
    1.42          const char *name = NULL;