use constant for error comparison

This commit is contained in:
Alex Zenla
2024-01-08 14:16:33 -08:00
parent f8938ac2c6
commit 8e2fc80ee0
3 changed files with 22 additions and 24 deletions

View File

@ -1,11 +1,12 @@
use xsd::bus::XsdBusError;
use xsd::client::XsdClient;
use xsd::sys::XSD_ERROR_EINVAL;
fn list_recursive(client: &mut XsdClient, level: usize, path: &str) -> Result<(), XsdBusError> {
let children = match client.list(path) {
Ok(children) => children,
Err(error) => {
return if error.to_string() == "EINVAL" {
return if error.to_string() == XSD_ERROR_EINVAL.error {
Ok(())
} else {
Err(error)