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 }