Commit ffc375f0 authored by Dan Jones's avatar Dan Jones
Browse files

Merge branch '18-add-stub-handler-for-received-invalid-message' into 'dev'

Resolve "Add stub handler for received invalid message"

Closes #18

See merge request !11
parents efd312d2 05a2d55c
......@@ -101,6 +101,8 @@ class Adapter {
if (validation.valid) {
const type = this.protocol.getType(parsed);
this.protocol.decode(type, parsed);
} else {
this.protocol.receivedInvalid(parsed, validation);
}
});
return response;
......
......@@ -103,6 +103,8 @@ class Adapter {
if (validation.valid) {
const type = this.protocol.getType(parsed);
this.protocol.decode(type, parsed);
} else {
this.protocol.receivedInvalid(parsed, validation);
}
});
return response;
......
......@@ -80,6 +80,18 @@ class GenericProtocol {
return message;
}
/**
* Invoked on receiving an invalid message from the backbone
*
* @param {object} message
* @param {object} validation
* @returns {*}
*/
receivedInvalid(message, validation) {
return message;
}
/**
* Optionally invoked before delivering a message to the backbone
*
......
......@@ -82,6 +82,18 @@ class GenericProtocol {
return message;
}
/**
* Invoked on receiving an invalid message from the backbone
*
* @param {object} message
* @param {object} validation
* @returns {*}
*/
receivedInvalid(message, validation) {
return message;
}
/**
* Optionally invoked before delivering a message to the backbone
*
......
......@@ -101,6 +101,8 @@ export class Adapter {
if (validation.valid) {
const type = this.protocol.getType(parsed);
this.protocol.decode(type, parsed);
} else {
this.protocol.receivedInvalid(parsed, validation);
}
});
return response;
......
......@@ -80,6 +80,18 @@ export class GenericProtocol {
return message;
}
/**
* Invoked on receiving an invalid message from the backbone
*
* @param {object} message
* @param {object} validation
* @returns {*}
*/
receivedInvalid(message, validation) {
return message;
}
/**
* Optionally invoked before delivering a message to the backbone
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment