Merge branch 'move-humanize-errors' into 'develop'
Move humanizeErrors to errors service file See merge request pleroma/pleroma-fe!2039
This commit is contained in:
commit
3c465e9a52
3 changed files with 11 additions and 12 deletions
0
changelog.d/move-humanize-errors.skip
Normal file
0
changelog.d/move-humanize-errors.skip
Normal file
|
@ -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]
|
||||
}, [])
|
||||
}
|
|
@ -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'
|
||||
|
|
Loading…
Add table
Reference in a new issue