@@ -16,14 +16,8 @@ exports.handler = async (event, context, callback) => {
1616 return await handleRequest ( request ) ;
1717 }
1818 catch ( e ) {
19- let errorText = e ;
20- if ( e instanceof Error ) {
21- errorText = e . toString ( ) ;
22- }
23- else if ( typeof e == 'object' ) {
24- errorText = JSON . stringify ( e ) ;
25- }
26- console . log ( "ERROR: Queue-it Connector" + errorText ) ;
19+ let errorText = getErrorText ( e ) ;
20+ console . log ( "ERROR: Queue-it Connector " + errorText ) ;
2721 return request ;
2822 }
2923} ;
@@ -38,7 +32,13 @@ async function handleRequest(request) {
3832 var requestUrl = httpContext . getHttpRequest ( ) . getAbsoluteUri ( ) ;
3933 var requestUrlWithoutToken = requestUrl . replace ( new RegExp ( "([\?&])(" + knownUser . QueueITTokenKey + "=[^&]*)" , 'i' ) , "" ) ;
4034 requestUrlWithoutToken = requestUrlWithoutToken . replace ( new RegExp ( "[?]$" ) , "" ) ;
41- var integrationConfig = await integrationConfigProvider . getConfig ( CustomerId , APIKey ) ;
35+ var integrationConfig = "" ;
36+ try {
37+ integrationConfig = await integrationConfigProvider . getConfig ( CustomerId , APIKey ) ;
38+ } catch ( e ) {
39+ let errorText = getErrorText ( e ) ;
40+ console . log ( "ERROR: Donwloading config " + errorText ) ;
41+ }
4242
4343 var validationResult = knownUser . validateRequestByIntegrationConfig (
4444 requestUrlWithoutToken , queueitToken , integrationConfig ,
@@ -97,4 +97,17 @@ async function handleRequest(request) {
9797 return request ;
9898 }
9999 }
100- }
100+ }
101+
102+ function getErrorText ( e ) {
103+ let errorText = e ;
104+ if ( e instanceof Error )
105+ {
106+ errorText = e . toString ( ) ;
107+ }
108+ else if ( typeof e == 'object' )
109+ {
110+ errorText = JSON . stringify ( e ) ;
111+ }
112+ return errorText ;
113+ }
0 commit comments