Skip to content

[fix][dbus] Improve vague error messages for D-Bus service register/unregister failures#1752

Open
zhaohai666 wants to merge 1 commit into
OpenAtom-Linyaps:masterfrom
zhaohai666:fix/dbus-register-error-messages
Open

[fix][dbus] Improve vague error messages for D-Bus service register/unregister failures#1752
zhaohai666 wants to merge 1 commit into
OpenAtom-Linyaps:masterfrom
zhaohai666:fix/dbus-register-error-messages

Conversation

@zhaohai666

Copy link
Copy Markdown

Summary

Original error messages for D-Bus service registration and unregistration failures were overly generic and lack necessary context:

  1. Registration conflict only showed service name existed.
  2. Unregistration failure only showed unknown
    Both messages missed the target service name and corresponding error code.

Changes

  1. Registration conflict error in registerDBusService
    Replace plain text service name existed. with formatted message:
    fmt::format("D-Bus service name '{}' already registered", serviceName)
    Attach ErrorCode::Failed to the error.

  2. Not-found error in unregisterDBusService
    Replace plain text unknown with formatted message:
    fmt::format("D-Bus service name '{}' not found", serviceName)
    Attach ErrorCode::Failed to the error.

Modified File

  • libs/linglong/src/linglong/common/dbus/register.h

Benefits

  • Error logs include exact D-Bus service name for quick troubleshooting
  • Distinct human-readable text differentiates duplicate registration vs missing unregister cases
  • Standardized error code attached uniformly for upstream error handling

Replace vague error messages in registerDBusService() and
unregisterDBusService() with descriptive messages that include
the service name and use proper ErrorCode::Failed instead of
FIXME placeholders.

Before:
- registerService error: "name: message" / "service name existed."
- unregisterService error: "name: message" / "unknown"

After:
- registerService error: "failed to register D-Bus service 'name': message"
- unregisterService error: "failed to unregister D-Bus service 'name': message"
- Service already registered: "D-Bus service name 'name' already registered"
- Service not found: "D-Bus service name 'name' not found"

Signed-off-by: zhaohaihzb <zhaohaihzb@126.com>
@deepin-ci-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zhaohai666

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown
Collaborator

Hi @zhaohai666. Thanks for your PR.

I'm waiting for a OpenAtom-Linyaps member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the D-Bus registration and unregistration functions in register.h to use proper error codes (utils::error::ErrorCode::Failed) and provides more descriptive error messages that include the service name. There are no review comments to address, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants