api/config: use http_bail for 'not found' errors

the api should return a 404 error for entries that do not exist

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Dominik Csapak
2022-03-04 14:47:51 +01:00
committed by Wolfgang Bumiller
parent 8d6425aa24
commit dcd1518e10
11 changed files with 32 additions and 32 deletions

View File

@ -1,11 +1,11 @@
/// Configure OpenId realms
use anyhow::{bail, Error};
use anyhow::Error;
use serde_json::Value;
use ::serde::{Deserialize, Serialize};
use hex::FromHex;
use proxmox_router::{Router, RpcEnvironment, Permission};
use proxmox_router::{http_bail, Router, RpcEnvironment, Permission};
use proxmox_schema::{api, param_bail};
use pbs_api_types::{
@ -112,7 +112,7 @@ pub fn delete_openid_realm(
}
if domains.sections.remove(&realm).is_none() {
bail!("realm '{}' does not exist.", realm);
http_bail!(NOT_FOUND, "realm '{}' does not exist.", realm);
}
domains::save_config(&domains)?;