Skip to content

Commit 145048c

Browse files
committed
chore: 🍺 improve response error
1 parent 3c5bdad commit 145048c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/core/BaseProxy.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,13 @@ class BaseProxy {
211211
this.errors.processing = false
212212
validator.processing = false
213213
const { response } = error
214-
if (response) {
215-
const { data, status } = response
216-
if (status === UNPROCESSABLE_ENTITY) {
217-
const errors = {}
218-
Object.assign(errors, data[this.$errorProperty])
219-
this.onFail(errors)
220-
}
221-
reject(error)
222-
} else {
223-
reject(error)
214+
if (response && response.status === UNPROCESSABLE_ENTITY) {
215+
const { data } = response
216+
const errors: Record<string, any> = {}
217+
Object.assign(errors, data[this.$errorProperty])
218+
this.onFail(errors)
224219
}
220+
reject(error)
225221
})
226222
})
227223
}

0 commit comments

Comments
 (0)