15 lines
388 B
JavaScript
15 lines
388 B
JavaScript
const stringifyError = (error = {}) => {
|
|
return JSON.stringify(error, Object.getOwnPropertyNames(error))
|
|
}
|
|
|
|
const potionErrorObj = (error = {}, details = {}) => {
|
|
const stringifiedError = stringifyError(error)
|
|
const stringifiedObject = JSON.stringify({
|
|
error: stringifiedError,
|
|
details,
|
|
})
|
|
return stringifiedObject
|
|
}
|
|
|
|
module.exports = { potionErrorObj, stringifyError }
|