File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
dotnet/src/dotnetframework/GxClasses/Helpers Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change 33using System . Linq ;
44using System . Text ;
55using System . Threading . Tasks ;
6+
67using GeneXus . Utils ;
78using GeneXus . Http . Client ;
9+
810using System . Web ;
11+
912using GeneXus . Mime ;
13+
14+ using System . Globalization ;
15+
1016#if NETCORE
1117using System . Text . Json ;
1218using System . Text . Json . Serialization ;
@@ -371,8 +377,21 @@ public Guid GetBodyGuid(string varName)
371377 }
372378
373379 public Decimal GetBodyNum ( string varName )
374- {
375- return Decimal . Parse ( GetJsonStr ( varName ) , System . Globalization . NumberStyles . Float ) ;
380+ {
381+ try
382+ {
383+ return Decimal . Parse ( GetJsonStr ( varName ) , NumberStyles . Float , CultureInfo . InvariantCulture ) ;
384+ }
385+ catch ( FormatException )
386+ {
387+ Console . WriteLine ( "Failed to parse number due to format exception." ) ;
388+ }
389+ catch ( OverflowException )
390+ {
391+ Console . WriteLine ( "Failed to parse number due to overflow exception." ) ;
392+ }
393+ // Return a empty value in case of an exception
394+ return 0m ;
376395 }
377396 public long GetBodyLong ( string varName )
378397 {
@@ -542,12 +561,10 @@ public void RestExecute()
542561 this . StatusMessage = httpClient . ReasonLine ;
543562 if ( httpClient . StatusCode >= 300 || httpClient . ErrCode > 0 )
544563 {
545-
546564 _responseData = new Dictionary < string , object > ( ) ;
547565 }
548566 else
549567 {
550-
551568 _responseData = GeneXus . Utils . RestAPIHelpers . ReadRestParameters ( httpClient . ToString ( ) ) ;
552569 }
553570 }
You can’t perform that action at this time.
0 commit comments