File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import CensorList , { CensorKeyValue } from '../util/censor/censor-list'
2+ import { AdapterError } from '../validation/error'
23import { Validator , validator } from '../validation/utils'
34
45export const BaseSettingsDefinition = {
@@ -597,7 +598,10 @@ export class EnvGetter<
597598 this . name . replace ( this . settingsDefinition . variablePlaceholder , canonicalVariable ) ,
598599 this . prefix ,
599600 )
600- throw new Error ( `Missing required environment variable: ${ envName } ` )
601+ throw new AdapterError ( {
602+ statusCode : 500 ,
603+ message : `Missing required environment variable: ${ envName } ` ,
604+ } )
601605 }
602606
603607 entries ( ) : VariableEnvVarEntry < SettingTypeWhenPresent < T > > [ ] {
Original file line number Diff line number Diff line change 66 SettingDefinition ,
77 SettingsDefinitionMap ,
88} from '../src/config'
9+ import { AdapterError } from '../src/validation/error'
910import { validator } from '../src/validation/utils'
1011import { Adapter } from '../src/adapter'
1112import { buildSettingsList } from '../src/util/settings'
@@ -317,7 +318,8 @@ test.serial('Get required variable env var', async (t) => {
317318 config . settings . NETWORK_RPC_URL . get ( 'arbitrum' )
318319 t . fail ( )
319320 } catch ( error ) {
320- t . is ( ( error as Error ) . message , 'Missing required environment variable: ARBITRUM_RPC_URL' )
321+ t . is ( ( error as AdapterError ) . message , 'Missing required environment variable: ARBITRUM_RPC_URL' )
322+ t . is ( ( error as AdapterError ) . statusCode , 500 )
321323 }
322324} )
323325
You can’t perform that action at this time.
0 commit comments