Skip to content

Commit

Permalink
Better layout for error
Browse files Browse the repository at this point in the history
  • Loading branch information
acavailhez-stripe committed Feb 15, 2019
1 parent 38e5a16 commit 69d2bbb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Stripe/STPEphemeralKeyManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,12 @@ - (void)_createKey {
} else {
// the ephemeral key could not be decoded
[self.createKeyPromise fail:[NSError stp_ephemeralKeyDecodingError]];
NSString *protocol = @"unknown";
if ([self.keyProvider conformsToProtocol:@protocol(STPCustomerEphemeralKeyProvider)]) {
protocol = @"STPCustomerEphemeralKeyProvider";
NSAssert(NO, @"Could not parse the ephemeral key response following protocol STPCustomerEphemeralKeyProvider. Make sure your backend is sending the unmodified JSON of the ephemeral key to your app. For more info, see https://stripe.com/docs/mobile/ios/standard#prepare-your-api");
} else if ([self.keyProvider conformsToProtocol:@protocol(STPIssuingCardEphemeralKeyProvider)]) {
protocol = @"STPIssuingCardEphemeralKeyProvider";
NSAssert(NO, @"Could not parse the ephemeral key response following protocol STPCustomerEphemeralKeyProvider. Make sure your backend is sending the unmodified JSON of the ephemeral key to your app. For more info, see https://stripe.com/docs/mobile/ios/standard#prepare-your-api");
}
NSString *errorString = [NSString stringWithFormat:@"Could not parse the ephemeral key response following protocol %@. Make sure your backend is sending the unmodified JSON of the ephemeral key to your app. For more info, see https://stripe.com/docs/mobile/ios/standard#prepare-your-api", protocol];
NSAssert(NO, errorString);
NSAssert(NO, @"Could not parse the ephemeral key response. Make sure your backend is sending the unmodified JSON of the ephemeral key to your app. For more info, see https://stripe.com/docs/mobile/ios/standard#prepare-your-api");
}
}
self.createKeyPromise = nil;
Expand Down

1 comment on commit 69d2bbb

@marcus-hiles
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this 👍

Please sign in to comment.