@@ -45,7 +45,7 @@ const redisReadHandler = async (context) => {
4545 "error during redis read"
4646 )
4747 ) ;
48- context . reject ( 500 , { message : "caught unexpected error during redis read, check server logs" } ) ;
48+ context . reject ( { code : 500 , message : "caught unexpected error during redis read, check server logs" } ) ;
4949 }
5050} ;
5151
@@ -75,7 +75,7 @@ const redisUpdateHandler = async (context) => {
7575 if ( Array . isArray ( validationErrors ) && validationErrors . length > 0 ) {
7676 for ( const { featureKey : target , errorMessage, errorMessageValues } of validationErrors ) {
7777 const errorMessageWithValues = textFormat ( errorMessage , errorMessageValues ) ;
78- context . error ( VALIDATION_ERROR_HTTP_CODE , { message : errorMessageWithValues } , [ ] , target ) ;
78+ context . error ( { code : VALIDATION_ERROR_HTTP_CODE , message : errorMessageWithValues , target } ) ;
7979 }
8080 }
8181 } ;
@@ -97,18 +97,19 @@ const redisUpdateHandler = async (context) => {
9797 "error during redis update"
9898 )
9999 ) ;
100- context . reject ( 500 , { message : "caught unexpected error during redis update, check server logs" } ) ;
100+ context . reject ( { code : 500 , message : "caught unexpected error during redis update, check server logs" } ) ;
101101 }
102102} ;
103103
104104const redisSendCommandHandler = async ( context ) => {
105105 const { command } = context . data ;
106106 if ( ! Array . isArray ( command ) ) {
107- context . reject ( 400 , { message : "request body needs to contain a 'command' field of type array" } ) ;
107+ context . reject ( { code : 400 , message : "request body needs to contain a 'command' field of type array" } ) ;
108108 return ;
109109 }
110- const result = await redis . sendCommand ( command ) ;
111- context . reply ( typeof result === "string" ? result : JSON . stringify ( result ) ) ;
110+ const redisResponse = await redis . sendCommand ( command ) ;
111+ const result = typeof redisResponse === "string" ? redisResponse : JSON . stringify ( redisResponse ) ;
112+ context . reply ( result ) ;
112113} ;
113114
114115module . exports = async ( srv ) => {
0 commit comments