File tree Expand file tree Collapse file tree 4 files changed +9
-4
lines changed
Expand file tree Collapse file tree 4 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,10 @@ public class Test
7474 {
7575 Console .WriteLine (" Catch custom exceptions:" + ex .Message );
7676 }
77+ catch (TimeoutException ex )
78+ {
79+ Console .WriteLine (" Timeout Exception: " + ex .Message );
80+ }
7781 catch (Exception ex )
7882 {
7983 Console .WriteLine (" Catch other exceptions:" + ex .Message );
Original file line number Diff line number Diff line change 99 <AssemblyName >TrackingMore-API</AssemblyName >
1010 <GenerateAssemblyInfo >false</GenerateAssemblyInfo >
1111 <PackageId >TrackingMore</PackageId >
12- <PackageVersion >0.1.0 </PackageVersion >
12+ <PackageVersion >0.1.1 </PackageVersion >
1313 <Authors >TrackingMore Team</Authors >
1414 <Copyright >Copyright 2014-2023</Copyright >
1515 <Owners >TrackingMore</Owners >
Original file line number Diff line number Diff line change 11using Newtonsoft . Json ;
2+ using System . Text . RegularExpressions ;
23using TrackingMoreAPI . Model ;
34using TrackingMoreAPI . Model . AirWaybills ;
45
@@ -12,8 +13,8 @@ public ApiResponse<AirWaybills> CreateAnAirWayBill(AirWaybillParams airWaybillPa
1213 {
1314 throw new TrackingMoreException ( Enums . ErrMissingAwbNumber ) ;
1415 }
15- if ( airWaybillParams . awbNumber . Length != 12 )
16- {
16+ if ( ! Regex . IsMatch ( airWaybillParams . awbNumber , @"^\d{3}[ -]?(\d{8})$" ) )
17+ {
1718 throw new TrackingMoreException ( Enums . ErrInvalidAirWaybillFormat ) ;
1819 }
1920 HttpMethod method = HttpMethod . Post ;
Original file line number Diff line number Diff line change @@ -8,5 +8,5 @@ public class Enums
88 public const string ErrMissingAwbNumber = "Awb number cannot be empty" ;
99 public const string ErrMaxTrackingNumbersExceeded = "Max. 40 tracking numbers create in one call" ;
1010 public const string ErrEmptyId = "Id cannot be empty" ;
11- public const string ErrInvalidAirWaybillFormat = "The air waybill number format is invalid and can only be 12 digits in length " ;
11+ public const string ErrInvalidAirWaybillFormat = "The air waybill number format is invalid" ;
1212}
You can’t perform that action at this time.
0 commit comments