Commit 6b7ed437 by Dima Bart

Convert to custom BUYAssert. Will throw exception in release builds.

parent 5eb4ae03
......@@ -414,6 +414,8 @@
9A47CF0D1CE4D6C600A6D5BA /* BUYCreditCardTokenTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A47CF0C1CE4D6C600A6D5BA /* BUYCreditCardTokenTests.m */; };
9A47CF0F1CE4D7A800A6D5BA /* BUYApplePayTokenTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A47CF0E1CE4D7A800A6D5BA /* BUYApplePayTokenTests.m */; };
9A47CF201CE50EBB00A6D5BA /* BUYApplePayTestToken.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A47CF1F1CE50EBB00A6D5BA /* BUYApplePayTestToken.m */; };
9A47CF221CE5112A00A6D5BA /* BUYAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A47CF211CE5112A00A6D5BA /* BUYAssert.h */; };
9A47CF231CE5112A00A6D5BA /* BUYAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A47CF211CE5112A00A6D5BA /* BUYAssert.h */; };
9A6B03791CDA5D4F0054C26E /* BUYAccountCredentialsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6B03781CDA5D4F0054C26E /* BUYAccountCredentialsTests.m */; };
BE10079B1B6165EC0031CEE7 /* BUYOptionValueCell.h in Headers */ = {isa = PBXBuildFile; fileRef = BE1007991B6165EC0031CEE7 /* BUYOptionValueCell.h */; };
BE10079C1B6165EC0031CEE7 /* BUYOptionValueCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BE10079A1B6165EC0031CEE7 /* BUYOptionValueCell.m */; };
......@@ -759,6 +761,7 @@
9A47CF0E1CE4D7A800A6D5BA /* BUYApplePayTokenTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYApplePayTokenTests.m; sourceTree = "<group>"; };
9A47CF1E1CE50EBB00A6D5BA /* BUYApplePayTestToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYApplePayTestToken.h; sourceTree = "<group>"; };
9A47CF1F1CE50EBB00A6D5BA /* BUYApplePayTestToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYApplePayTestToken.m; sourceTree = "<group>"; };
9A47CF211CE5112A00A6D5BA /* BUYAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BUYAssert.h; path = ../Additions/BUYAssert.h; sourceTree = "<group>"; };
9A6B03781CDA5D4F0054C26E /* BUYAccountCredentialsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYAccountCredentialsTests.m; sourceTree = "<group>"; };
BE1007991B6165EC0031CEE7 /* BUYOptionValueCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYOptionValueCell.h; sourceTree = "<group>"; };
BE10079A1B6165EC0031CEE7 /* BUYOptionValueCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYOptionValueCell.m; sourceTree = "<group>"; };
......@@ -1282,6 +1285,7 @@
F773744519C779C20039681C /* Utils */ = {
isa = PBXGroup;
children = (
9A47CF211CE5112A00A6D5BA /* BUYAssert.h */,
F70CE40D1A8BF1D90055BEB8 /* BUYApplePayAdditions.h */,
F70CE40E1A8BF1D90055BEB8 /* BUYApplePayAdditions.m */,
BE33B4ED1B15FF4D0067982B /* BUYApplePayHelpers.h */,
......@@ -1368,6 +1372,7 @@
84DD12AD1CC63FE600A2442D /* _BUYProductVariant.h in Headers */,
84980F2A1CB75AC200CFAB58 /* BUYObjectProtocol.h in Headers */,
901931281BC5B9BC00D1134E /* BUYApplePayHelpers.h in Headers */,
9A47CF231CE5112A00A6D5BA /* BUYAssert.h in Headers */,
901931291BC5B9BC00D1134E /* BUYStoreViewController.h in Headers */,
9019312A1BC5B9BC00D1134E /* BUYCreditCard.h in Headers */,
9019312B1BC5B9BC00D1134E /* BUYOption.h in Headers */,
......@@ -1485,6 +1490,7 @@
84DD128B1CC63FE600A2442D /* _BUYLineItem.h in Headers */,
84980F291CB75AC200CFAB58 /* BUYObjectProtocol.h in Headers */,
BE9A64741B503D2E0033E558 /* BUYApplePayHelpers.h in Headers */,
9A47CF221CE5112A00A6D5BA /* BUYAssert.h in Headers */,
BE9A647E1B503D930033E558 /* BUYStoreViewController.h in Headers */,
BE9A64551B503CC50033E558 /* BUYCreditCard.h in Headers */,
BE9A645F1B503CE90033E558 /* BUYOption.h in Headers */,
......
//
// BUYAssert.h
// Mobile Buy SDK
//
// Created by Dima Bart on 2016-05-12.
// Copyright © 2016 Shopify Inc. All rights reserved.
//
#define BUYAssert(exp, ...) \
do { \
if (!(exp)) { \
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:[NSString stringWithFormat:__VA_ARGS__] userInfo:nil]; \
} \
} while(0)
......@@ -26,6 +26,7 @@
#import "BUYClient_Internal.h"
#import "BUYAssert.h"
#import "BUYAddress.h"
#import "BUYCart.h"
#import "BUYCheckout.h"
......@@ -55,7 +56,7 @@
#define kMinSuccessfulStatusCode 200
#define kMaxSuccessfulStatusCode 299
#define BUYAssertCheckout(checkout) NSAssert([(checkout) hasToken], @"Checkout assertion failed. Checkout must have a valid token associated with it.")
#define BUYAssertCheckout(checkout) BUYAssert([(checkout) hasToken], @"Checkout assertion failed. Checkout must have a valid token associated with it.")
NSString * const BUYVersionString = @"1.3";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment