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:
committed by
Wolfgang Bumiller
parent
8d6425aa24
commit
dcd1518e10
@ -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)?;
|
||||
|
Reference in New Issue
Block a user