You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wiki/server/helpers/graph.js

22 lines
507 B

const _ = require('lodash')
module.exports = {
generateSuccess (msg) {
return {
succeeded: true,
errorCode: 0,
slug: 'ok',
message: _.defaultTo(msg, 'Operation succeeded.')
}
},
generateError (err, complete = true) {
const error = {
succeeded: false,
errorCode: _.isFinite(err.code) ? err.code : 1,
slug: err.name,
message: err.message || 'An unexpected error occured.'
}
return (complete) ? { responseResult: error } : error
}
}