Skip to content

Commit

Permalink
Merge pull request #29 from thisisthekap/br_28_fix_argument_null_exce…
Browse files Browse the repository at this point in the history
…ption
  • Loading branch information
thisisthekap authored Oct 27, 2022
2 parents 54a20c5 + 069d6e8 commit a9ddf27
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
13 changes: 11 additions & 2 deletions Xamarin.RevenueCat.iOS.Extensions/PurchasesErrorException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public class PurchasesErrorException : Exception
public RCPurchasesErrorCode PurchasesErrorCode { get; }

public PurchasesErrorException(NSError purchasesError, bool userCancelled)
: base($"{purchasesError?.Description} userCancelled: {userCancelled}",
new NSErrorException(purchasesError))
: base($"{purchasesError?.Description} userCancelled: {userCancelled}", WrapError(purchasesError))
{
PurchasesError = purchasesError;
UserCancelled = userCancelled;
Expand All @@ -33,5 +32,15 @@ public PurchasesErrorException(NSError purchasesError, bool userCancelled)
PurchasesErrorCode = (RCPurchasesErrorCode)purchaseErrorCodeInt;
}
}

private static NSErrorException WrapError(NSError purchasesError)
{
if (purchasesError != null)
{
return new NSErrorException(purchasesError);
}

return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<IsPackable>true</IsPackable>
<PackageId>Xamarin.RevenueCat.iOS.Extensions</PackageId>
<Description>Contains convenience methods and async extensions for Xamarin.RevenueCat.iOS</Description>
<Version>4.9.0.3</Version>
<Version>4.9.0.4</Version>
<Authors>Christian Kapplmüller</Authors>
<Company>fun.music IT GmbH</Company>
<PackageOutputPath>nugetoutput</PackageOutputPath>
Expand Down
4 changes: 3 additions & 1 deletion Xamarin.RevenueCat.iOS.UsageChecker/ViewController.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
using Foundation;
using System;
using UIKit;
using Xamarin.RevenueCat.iOS.Extensions;

namespace Xamarin.RevenueCat.iOS.UsageChecker
{
public partial class ViewController : UIViewController
{
public ViewController(IntPtr handle) : base(handle)
{
var userCancelledException = new PurchasesErrorException(null, true);
Console.WriteLine(userCancelledException);
}

public override void ViewDidLoad()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xamarin.RevenueCat.iOS.Extensions\Xamarin.RevenueCat.iOS.Extensions.csproj">
<Project>{9774c184-1a52-40a3-82f7-3d27f92ad38e}</Project>
<Name>Xamarin.RevenueCat.iOS.Extensions</Name>
</ProjectReference>
<ProjectReference Include="..\Xamarin.RevenueCat.iOS\Xamarin.RevenueCat.iOS.csproj">
<Project>{EAA9C04E-CFAD-49D2-A3A8-168A811D79DA}</Project>
<Name>Xamarin.RevenueCat.iOS</Name>
Expand Down

0 comments on commit a9ddf27

Please sign in to comment.