Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MF encapsulating error inside result field in novalidate mode #158

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions server/src/stateManagement.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ async function handleDynamicResponseValues(userId, methodName, params, ws, resp)
// After the result function was called, we're realizing what it returned isn't valid!
logInvalidMethodError(methodName, resultErrors, resp);
}
if (typeof result === "object" && result.hasOwnProperty("error")) {
resp = result;
} else if (typeof result === "object" && result.hasOwnProperty("code")) {
resp = {
error: result,
};
}
} catch ( ex ) {
if ( ex instanceof commonErrors.FireboltError ) {
// Looks like the function threw a FireboltError, which means we want to mock an error, not a result
Expand Down
Loading