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

Callbacks not required. Log any errors for the developer. #112

Closed
wants to merge 1 commit into from

Conversation

marshallswain
Copy link
Member

Addressing #96 . This makes callbacks optional for all service methods. If no callback is provided, one is added in commons.js. If there is an error, it will be logged to the server console in this format:

Error on <location>::<method>  [<args array>]  <the service's error message>

For example:

Error on todos::find [ { query: { test: 'this is a test' } }, [Function] ] Error: There was a problem blah blah blah

@@ -35,6 +35,18 @@ exports.setupMethodHandler = function setupMethodHandler(emitter, params, servic
if(typeof args[position] === 'function') {
args.splice(position, 0, {});
}

// If no callback was provided...
if (typeof args[args.length - 1] !== 'function') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to fire back an error event (or something similar) like emitter.emit('error', err).

@daffl
Copy link
Member

daffl commented Feb 17, 2015

Is it ok if we close this one and fix everything in #113 instead?

@marshallswain
Copy link
Member Author

Sure thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants