Skip to content

Commit

Permalink
Return method along with error if unknown-method
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeoneWeird committed Mar 27, 2015
1 parent 576070a commit 63d03e3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
Changelog 3.1.0:

* Return method along with error if unknown-method

Changelog 3.0.0:

* Remove automatic dependency injection. Export a function that takes all of your required arguments instead.
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "hudson-taylor",
"version": "3.0.0",
"version": "3.1.0",
"description": "Library for building services.",
"main": "index.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion src/service.js
Expand Up @@ -29,7 +29,7 @@ let Service = function Service(Transports, config) {

this.fn = function(method, data, cb) {
let _tmp = self._methods[method];
if(!_tmp) return cb({ error: "unknown-method" });
if(!_tmp) return cb({ error: "unknown-method", method: method });

if(_tmp.schema) {
try {
Expand Down
5 changes: 4 additions & 1 deletion test-src/service.js
Expand Up @@ -210,9 +210,12 @@ describe("Service", function() {

let service = new Service(transport());

service.call("unknown", {}, function(err) {
let _method = "unknown";

service.call(_method, {}, function(err) {

assert.equal(err.error, "unknown-method");
assert.equal(err.method, _method);

done();

Expand Down

0 comments on commit 63d03e3

Please sign in to comment.