Skip to content

Commit

Permalink
formatting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kdivya153 committed May 21, 2024
1 parent 4317537 commit 38cf7a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion server/src/fireboltOpenRpc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ function validateMethodResult(val, methodName) {
const schemaName = ref.substring(ref.lastIndexOf('/') + 1);
oSchema = getSchema(schemaName);
}

const validate = ajv.compile(oSchema);
const valid = validate(val);
if ( !valid ) {
Expand Down
1 change: 1 addition & 0 deletions server/src/messageHandler.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ async function handleMessage(message, userId, ws) {
let response, newResponse;

logger.debug(`Received message for user ${userId} : ${message}`);

const oMsg = JSON.parse(message);
if (oMsg.method && config.app.caseInsensitiveModules) {
oMsg.method = util.createCaseAgnosticMethod(oMsg.method);
Expand Down
14 changes: 5 additions & 9 deletions server/src/stateManagement.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,10 @@ async function handleDynamicResponseValues(userId, methodName, params, ws, resp)
},
FireboltError: commonErrors.FireboltError
};
const sFcnBody = resp.response + ';' + 'return f(ctx, params);';
const fcn = new Function('ctx', 'params', sFcnBody);
const result = await fcn(ctx, params);

const resultErrors = fireboltOpenRpc.validateMethodResult(result, methodName);


const sFcnBody = resp.response + ';' + 'return f(ctx, params);';
const fcn = new Function('ctx', 'params', sFcnBody);
const result = await fcn(ctx, params);
const resultErrors = fireboltOpenRpc.validateMethodResult(result, methodName);
if ( ! resultErrors || resultErrors.length === 0 ) {
resp = {
result: result
Expand Down Expand Up @@ -312,7 +309,6 @@ async function handleDynamicResponseValues(userId, methodName, params, ws, resp)

return resp;
}

// Handle result values, which are either specified as static values or
// as functions which return values
function handleStaticAndDynamicResult(userId, methodName, params, resp){
Expand All @@ -335,7 +331,7 @@ function handleStaticAndDynamicResult(userId, methodName, params, resp){
resp = {
result: result
};
} else {
} else {fireboltOpenRpc
// After the result function was called, we're realizing what it returned isn't valid!
logInvalidMethodError(methodName, resultErrors, resp);
}
Expand Down

0 comments on commit 38cf7a3

Please sign in to comment.