-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Hi,
I really like the node-okay module. I now would like it to support some more functionality and I would like your feedback before implementing and creating a PR.
The issue I have is that I am using an external module that does not conform to the syntax I would like to have on the error message. Today the code looks something like this.
someFunction(parameter, function(err,result){
if(err){
callback({error: err}); // Here I transform the syntax of err to a new format, this is just an example
} else {
// Do some stuff with result
callback(null,result);
}
}));
What I would like to have is something like the following
var errorMapping = function(value) { return { error: value}; };
someFunction(parameter, ok(callback,errorMapping,function(result){
// Do some stuff with result
callback(null,result);
}));
Since I have this kind of code in many places this kind of simplification would make it much more easier to write, read, and not consume so many lines.
Comments on this proposal?
Something that could land in the official node-okay repo or should I land it in a fork?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels