The idiomatic Node.js way is to use a single callback that takes error as the first argument.

```
function registerArfifact(filename, version, body, res, sucessCallback, errorCallback){
// etc.
}

callback = function(err, res) {
  if (err) {
    // handle the error
    return;
  }
}
```

The contract of `registerArtifact` is a bit weird, as it sometimes handle the error and sometimes does not, depending on the value of callback (errorCallback). I also find it rather strange that it modifies the response object, as that means it cannot be really used as a step in a bigger workflow.

This would be a better solution:

```js
function registerArfifact(filename, version, body, callback) {
 // implementation
 // on error:
 err.status = 500; // or 400
 err.code: 'internal_server_error'; // or 'bad_request'
 err.reason: 'package file cannot be read'
 callback(err);
}

// in the callback:

res.json(err.status || 500, {
  error: err.code || 'internal_server_error',
  reason: err.reason || err.toString()
});
```

Also note you have a typo in the function name - it should be `registerArtifact`, not `registerArfifact`.