Merge pull request #2691 from cgwalters/strip-remote-error

clientlib: Strip GDBus remote error before throwing exception
This commit is contained in:
Jonathan Lebon 2021-03-23 10:49:45 -04:00 committed by GitHub
commit 0fd82990c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -270,7 +270,12 @@ ClientConnection::transaction_connect_progress_sync(const rust::Str address) con
g_autoptr(GCancellable) cancellable = g_cancellable_new();
auto address_c = g_strndup(address.data(), address.length());
if (!impl_transaction_get_response_sync (conn, address_c, cancellable, &local_error))
util::throw_gerror(local_error);
{
// In this case the caller doesn't care about the remote exception; we never
// try to match on it.
g_dbus_error_strip_remote_error (local_error);
util::throw_gerror(local_error);
}
}
} // namespace

View File

@ -73,6 +73,8 @@ if rpm-ostree ex apply-live 2>err.txt; then
fatal "live-removed foo"
fi
assert_file_has_content_literal err.txt 'packages would be removed: 1, enable replacement to override'
# Ensure remote error is stripped
assert_not_file_has_content_literal err.txt 'GDBus.Error'
rpm-ostree ex livefs --allow-replacement | tee out.txt
assert_file_has_content out.txt 'Added:'
assert_file_has_content out.txt ' bar-1.0'