I use mailcore2 , which is blocky. Usually they define such an operation
SomeMailCoreOp *op = [session getOp]; [op start:^(NSError* error, id result) { if (error) {
So, what I wanted to do was just to simply throw an NSException every time an error occurs .. so that I can catch it somewhere else in my code base .. So I created a category for NSError :
@implementation NSError (Addons) -(NSString *)description { return [NSString stringWithFormat:@"%@ - %@", [self localizedDescription], [self localizedFailureReason]]; } @end
and I would like to handle errors as a rule:
SomeMailCoreOp *op = [session getOp]; [op start:^(NSError* error, id result) { if (error) { [NSException raise:@"failure" format:[error description]]; } }];
I thought this made sense since in the documentation for NSException they got this for format :
a human-readable string (that is, an exception reason) with conversion specifications for the variable arguments that follow.
but I always get this compiler warning when I do this:
format string is not a string literal (potentially insecure)
how do i get around this?
source share