logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/
commit: 2af00f7c7eca18764a46161770dfdd300602e65e
parent f659c9c123622a5206f17f6f17711f0572fc2119
Author: Sean King <seanking2919@protonmail.com>
Date:   Sat,  8 Feb 2025 19:26:29 -0700

Move humanizeErrors to errors service file

Diffstat:

Achangelog.d/move-humanize-errors.skip0
Dsrc/modules/errors.js11-----------
Msrc/services/errors/errors.js12+++++++++++-
3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/changelog.d/move-humanize-errors.skip b/changelog.d/move-humanize-errors.skip diff --git a/src/modules/errors.js b/src/modules/errors.js @@ -1,11 +0,0 @@ -import { capitalize } from 'lodash' - -export function humanizeErrors (errors) { - return Object.entries(errors).reduce((errs, [k, val]) => { - const message = val.reduce((acc, message) => { - const key = capitalize(k.replace(/_/g, ' ')) - return acc + [key, message].join(' ') + '. ' - }, '') - return [...errs, message] - }, []) -} diff --git a/src/services/errors/errors.js b/src/services/errors/errors.js @@ -1,4 +1,14 @@ -import { humanizeErrors } from '../../modules/errors' +import { capitalize } from 'lodash' + +function humanizeErrors (errors) { + return Object.entries(errors).reduce((errs, [k, val]) => { + const message = val.reduce((acc, message) => { + const key = capitalize(k.replace(/_/g, ' ')) + return acc + [key, message].join(' ') + '. ' + }, '') + return [...errs, message] + }, []) +} export function StatusCodeError (statusCode, body, options, response) { this.name = 'StatusCodeError'