Improve link error messages

Reverse the reversal of source/target in message errors and add link
source and target to the error given when a validator is missing on a
link.
This commit is contained in:
Hornwitser committed 2019-12-13 21:39:54 +01:00
1 parent b24778dce6
commit 47cff048f0
4 files changed
+8 -8

No files matched your search

+2 -2
View File
@@ -64,7 +64,7 @@ describe("lib/link/link", function() {
it("should throw on message without validator", function() {
assert.throws(
() => testLink.processMessage({ seq: 1, type: 'no_validator', data: {} }),
new errors.InvalidMessage("No validator for no_validator")
new errors.InvalidMessage("No validator for no_validator on source-target")
);
});
it("should throw on message failing validation", function() {
@@ -134,7 +134,7 @@ describe("lib/link/link", function() {
it("should throw on missing validator", async function() {
await assert.rejects(
testLink.waitFor('no_validator', {}),
new Error("no validator for no_validator")
new Error("No validator for no_validator on source-target")
);
});
it("should wait for a given message", async function() {
+2 -2
View File
@@ -26,7 +26,7 @@ describe("lib/link/messages", function() {
it("should throw if missing handler on target link", function() {
assert.throws(
() => testRequest.attach(testTargetLink),
new Error("Missing handler for test_request on source-target link")
new Error("Missing handler for test_request on target-source link")
);
});
@@ -120,7 +120,7 @@ describe("lib/link/messages", function() {
it("should throw if missing handler on target link", function() {
assert.throws(
() => testEvent.attach(testTargetLink),
new Error("Missing handler for test_event on source-target link")
new Error("Missing handler for test_event on target-source link")
);
});
let called = false;