feat(upload-ova): special handling of invalid params error (#6626)
Fixes #6622 Similar to036b30212&65daa39eb
This commit is contained in:
@@ -182,7 +182,20 @@ export async function upload(args) {
|
||||
// FIXME: do not use private properties.
|
||||
const baseUrl = xo._url.replace(/^ws/, 'http')
|
||||
|
||||
const result = await xo.call(method, params)
|
||||
const result = await xo.call(method, params).catch(error => {
|
||||
if (!(error != null && error.code === 10 && 'errors' in error.data)) {
|
||||
throw error
|
||||
}
|
||||
|
||||
const lines = [error.message]
|
||||
const { errors } = error.data
|
||||
errors.forEach(error => {
|
||||
let { instancePath } = error
|
||||
instancePath = instancePath.length === 0 ? '@' : '@.' + instancePath
|
||||
lines.push(` property ${instancePath}: ${error.message}`)
|
||||
})
|
||||
throw lines.join('\n')
|
||||
})
|
||||
let keys, key, url
|
||||
if (isObject(result) && (keys = getKeys(result)).length === 1) {
|
||||
key = keys[0]
|
||||
|
||||
@@ -27,4 +27,6 @@
|
||||
|
||||
<!--packages-start-->
|
||||
|
||||
- xo-server-upload-ova patch
|
||||
|
||||
<!--packages-end-->
|
||||
|
||||
Reference in New Issue
Block a user