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,
|
||||
optional: true,
|
||||
},
|
||||
"json-error": {
|
||||
type: Boolean,
|
||||
description: "If set, errors are returned as json instead of writing to stderr",
|
||||
optional: true,
|
||||
default: false,
|
||||
},
|
||||
"timeout": {
|
||||
type: Integer,
|
||||
description: "Defines the maximum time the call can should take.",
|
||||
@ -248,7 +242,6 @@ async fn list(
|
||||
snapshot: String,
|
||||
path: String,
|
||||
base64: bool,
|
||||
json_error: bool,
|
||||
timeout: Option<u64>,
|
||||
param: Value,
|
||||
) -> Result<(), Error> {
|
||||
@ -293,7 +286,7 @@ async fn list(
|
||||
let output_format = get_output_format(¶m);
|
||||
|
||||
if let Err(err) = result {
|
||||
if !json_error {
|
||||
if &output_format == "text" {
|
||||
return Err(err);
|
||||
}
|
||||
let (msg, code) = match err.downcast_ref::<HttpError>() {
|
||||
@ -301,7 +294,6 @@ async fn list(
|
||||
None => (err.to_string(), None),
|
||||
};
|
||||
let mut json_err = json!({
|
||||
"error": true,
|
||||
"message": msg,
|
||||
});
|
||||
if let Some(code) = code {
|
||||
|
Loading…
x
Reference in New Issue
Block a user