This repository was archived by the owner on Oct 20, 2022. It is now read-only.
Send error message to client#11
Open
adlerparnas wants to merge 1 commit intoOrange-OpenSource:masterfrom
Open
Conversation
I believe that if you returned an error as a response to a call, you should be able to read the error on the client
|
👍 |
|
Actually this is still wrong, look at the spec: So, "wamp.error.callee_failure" should be replaced by |
|
I believe this would be correct: var resultCallback = function(err, args) {
var msg;
if (err) {
msg = [
WAMP.ERROR,
WAMP.CALL,
callId,
{},
err
];
} else {
msg = [
WAMP.RESULT,
callId,
{},
];
}
// Manage optional parameters args + kwargs
for(var i = 0; i < args.length && i < 2; i++) {
msg.push(args[i]);
}
session.send(msg);
}; |
|
The other problem with sending errors is in handlers[WAMP.ERROR] = function(session, msg) {
var requestType = msg.shift();
var requestId = msg.shift();
var details = msg.shift();
var errorUri = msg.shift();
var args = msg.shift() || [];
var kwargs = msg.shift() || {};
var err = new Error(details); // <--- this line
if (requestType === WAMP.INVOCATION) {
// An invocation failed
var invId = requestId;
this.resrpc(invId, err, args); // <--- only err and args objects passed?
}
}Several problems:
|
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I believe that if you returned an error as a response to a call, you should be able to read the error on the client