Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface not found: DBus::Error instead of nil (and then NoMethodError) #74

Merged
merged 1 commit into from
Apr 30, 2018

Commits on Apr 30, 2018

  1. Interface not found: DBus::Error instead of nil (and then NoMethodError)

    The example below would be correct if it said
    `unit_o["org.freedesktop.systemd1.Unit"]`.
    
    With the wrong interface name, `unit_i` used to become `nil` and you
    would get an unhelpful
    "NoMethodError: undefined method `[]' for nil:NilClass" later.
    
    With this fix, it raises
    "DBus::Error: no such interface `Unit' on object `/org/freedesktop/systemd1/unit/_2d_2emount'"
    
    ```rb
    bus = DBus::SystemBus.instance
    svc = bus.service("org.freedesktop.systemd1")
    unit_o = svc["/org/freedesktop/systemd1/unit/_2d_2emount"]
    unit_i = unit_o["Unit"]  # BUG
    descr = unit_i["Description"]
    ```
    mvidner committed Apr 30, 2018
    Configuration menu
    Copy the full SHA
    794f3cc View commit details
    Browse the repository at this point in the history