Skip to content

next() function needs an argument for indicating an error #1

@lukehesluke

Description

@lukehesluke

The next() function handed to calls to init(), start() and stop() should have an argument for indicating an error. So you can do something like:

start: function(next) {
  someFunctionReturningAPromise().then(function() {
    throw new Error('something bad! D: D:');
    next();
  }).catch(function(err) {
    next(err);
  });
}

This above should then attempt to shut down all previously started dependencies. If there's an error in a service's stop(), it will just have to be aborted and continue stopping other dependencies. After the full shutdown, either all errors or the first should be thrown, so as to notify the user what's happened

As far as I can tell there's no process for handling errors (especially asynchronous ones) at the moment

I can happily work on this myself or help out. Lemme know your thoughts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions