chargebee-dotnet icon indicating copy to clipboard operation
chargebee-dotnet copied to clipboard

InvalidRequestException - handling specific fields

Open ecollis6 opened this issue 5 years ago • 1 comments

Hey, I noticed an issue while I was trying to gracefully handle coupon errors. From what I can tell, there is not a good way to programmatically handle errors for specific fields. According to the documentation, I should be able to use the Param field on InvalidRequestException to determine the incorrect parameter, but from my experience, it has always been null. In the meantime, I am using ApiCode, however, it is deprecated.

-		(ApiException) e	{"Coupon INVALID_COUPON_TEST cannot be applied as it is not applicable to any of the items"}	ChargeBee.Api.ApiException {ChargeBee.Exceptions.InvalidRequestException}
		ApiCode	"coupon_not_applicable"	string
		ApiErrorCode	"invalid_request"	string
		ApiMessage	"Coupon INVALID_COUPON_TEST cannot be applied as it is not applicable to any of the items"	string
+		Data	{System.Collections.ListDictionaryInternal}	System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
		HResult	-2146233088	int
		HelpLink	null	string
		HttpCode	BadRequest	System.Net.HttpStatusCode
		HttpStatusCode	BadRequest	System.Net.HttpStatusCode
+		InnerException	null	System.Exception
		Message	"Coupon INVALID_COUPON_TEST cannot be applied as it is not applicable to any of the items"	string
		Param	null	string
		Parameter	null	string
		Source	"ChargeBee"	string
+		TargetSite	{Void HandleException(System.Net.Http.HttpResponseMessage)}	System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
		Type	"invalid_request"	string
+		Static members		
+		Non-Public members		

ecollis6 avatar Jul 24 '19 18:07 ecollis6