@@ -42,7 +42,7 @@ import { FeatureFlagTracingOptions } from "./requestTracing/FeatureFlagTracingOp
4242import { KeyFilter , LabelFilter , SettingSelector } from "./types.js" ;
4343import { ConfigurationClientManager } from "./ConfigurationClientManager.js" ;
4444import { getFixedBackoffDuration , calculateBackoffDuration } from "./failover.js" ;
45- import { OperationError , isFailoverableError , isRetriableError } from "./error.js" ;
45+ import { OperationError , ArgumentError , isFailoverableError , isRetriableError } from "./error.js" ;
4646
4747type PagedSettingSelector = SettingSelector & {
4848 /**
@@ -126,10 +126,10 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
126126 } else {
127127 for ( const setting of watchedSettings ) {
128128 if ( setting . key . includes ( "*" ) || setting . key . includes ( "," ) ) {
129- throw new RangeError ( "The characters '*' and ',' are not supported in key of watched settings." ) ;
129+ throw new ArgumentError ( "The characters '*' and ',' are not supported in key of watched settings." ) ;
130130 }
131131 if ( setting . label ?. includes ( "*" ) || setting . label ?. includes ( "," ) ) {
132- throw new RangeError ( "The characters '*' and ',' are not supported in label of watched settings." ) ;
132+ throw new ArgumentError ( "The characters '*' and ',' are not supported in label of watched settings." ) ;
133133 }
134134 this . #sentinels. push ( setting ) ;
135135 }
@@ -138,7 +138,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
138138 // custom refresh interval
139139 if ( refreshIntervalInMs !== undefined ) {
140140 if ( refreshIntervalInMs < MIN_REFRESH_INTERVAL_IN_MS ) {
141- throw new RangeError ( `The refresh interval cannot be less than ${ MIN_REFRESH_INTERVAL_IN_MS } milliseconds.` ) ;
141+ throw new ArgumentError ( `The refresh interval cannot be less than ${ MIN_REFRESH_INTERVAL_IN_MS } milliseconds.` ) ;
142142 } else {
143143 this . #kvRefreshInterval = refreshIntervalInMs ;
144144 }
@@ -156,7 +156,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
156156 // custom refresh interval
157157 if ( refreshIntervalInMs !== undefined ) {
158158 if ( refreshIntervalInMs < MIN_REFRESH_INTERVAL_IN_MS ) {
159- throw new RangeError ( `The feature flag refresh interval cannot be less than ${ MIN_REFRESH_INTERVAL_IN_MS } milliseconds.` ) ;
159+ throw new ArgumentError ( `The feature flag refresh interval cannot be less than ${ MIN_REFRESH_INTERVAL_IN_MS } milliseconds.` ) ;
160160 } else {
161161 this . #ffRefreshInterval = refreshIntervalInMs ;
162162 }
@@ -265,7 +265,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
265265 const separator = options ?. separator ?? "." ;
266266 const validSeparators = [ "." , "," , ";" , "-" , "_" , "__" , "/" , ":" ] ;
267267 if ( ! validSeparators . includes ( separator ) ) {
268- throw new RangeError ( `Invalid separator '${ separator } '. Supported values: ${ validSeparators . map ( s => `'${ s } '` ) . join ( ", " ) } .` ) ;
268+ throw new ArgumentError ( `Invalid separator '${ separator } '. Supported values: ${ validSeparators . map ( s => `'${ s } '` ) . join ( ", " ) } .` ) ;
269269 }
270270
271271 // construct hierarchical data object from map
@@ -729,7 +729,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
729729 async #parseFeatureFlag( setting : ConfigurationSetting < string > ) : Promise < any > {
730730 const rawFlag = setting . value ;
731731 if ( rawFlag === undefined ) {
732- throw new RangeError ( "The value of configuration setting cannot be undefined." ) ;
732+ throw new ArgumentError ( "The value of configuration setting cannot be undefined." ) ;
733733 }
734734 const featureFlag = JSON . parse ( rawFlag ) ;
735735
@@ -953,13 +953,13 @@ function getValidSelectors(selectors: SettingSelector[]): SettingSelector[] {
953953 return uniqueSelectors . map ( selectorCandidate => {
954954 const selector = { ...selectorCandidate } ;
955955 if ( ! selector . keyFilter ) {
956- throw new RangeError ( "Key filter cannot be null or empty." ) ;
956+ throw new ArgumentError ( "Key filter cannot be null or empty." ) ;
957957 }
958958 if ( ! selector . labelFilter ) {
959959 selector . labelFilter = LabelFilter . Null ;
960960 }
961961 if ( selector . labelFilter . includes ( "*" ) || selector . labelFilter . includes ( "," ) ) {
962- throw new RangeError ( "The characters '*' and ',' are not supported in label filters." ) ;
962+ throw new ArgumentError ( "The characters '*' and ',' are not supported in label filters." ) ;
963963 }
964964 return selector ;
965965 } ) ;
0 commit comments