mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-10-04 18:48:10 +00:00
file-restore: remove 'json-error' parameter from list_files
we can reuse the 'output_format' here also remove the 'error: true' here. we can determine it was an error, by checking if it's an object with a 'message' property Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
1053a71e81
commit
ba690c4023
@ -220,12 +220,6 @@ async fn list_files(
|
|||||||
schema: OUTPUT_FORMAT,
|
schema: OUTPUT_FORMAT,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
"json-error": {
|
|
||||||
type: Boolean,
|
|
||||||
description: "If set, errors are returned as json instead of writing to stderr",
|
|
||||||
optional: true,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
"timeout": {
|
"timeout": {
|
||||||
type: Integer,
|
type: Integer,
|
||||||
description: "Defines the maximum time the call can should take.",
|
description: "Defines the maximum time the call can should take.",
|
||||||
@ -248,7 +242,6 @@ async fn list(
|
|||||||
snapshot: String,
|
snapshot: String,
|
||||||
path: String,
|
path: String,
|
||||||
base64: bool,
|
base64: bool,
|
||||||
json_error: bool,
|
|
||||||
timeout: Option<u64>,
|
timeout: Option<u64>,
|
||||||
param: Value,
|
param: Value,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
@ -293,7 +286,7 @@ async fn list(
|
|||||||
let output_format = get_output_format(¶m);
|
let output_format = get_output_format(¶m);
|
||||||
|
|
||||||
if let Err(err) = result {
|
if let Err(err) = result {
|
||||||
if !json_error {
|
if &output_format == "text" {
|
||||||
return Err(err);
|
return Err(err);
|
||||||
}
|
}
|
||||||
let (msg, code) = match err.downcast_ref::<HttpError>() {
|
let (msg, code) = match err.downcast_ref::<HttpError>() {
|
||||||
@ -301,7 +294,6 @@ async fn list(
|
|||||||
None => (err.to_string(), None),
|
None => (err.to_string(), None),
|
||||||
};
|
};
|
||||||
let mut json_err = json!({
|
let mut json_err = json!({
|
||||||
"error": true,
|
|
||||||
"message": msg,
|
"message": msg,
|
||||||
});
|
});
|
||||||
if let Some(code) = code {
|
if let Some(code) = code {
|
||||||
|
Loading…
Reference in New Issue
Block a user