Skip to content

Commit

Permalink
remote-desktop: improve an error message
Browse files Browse the repository at this point in the history
The check_notify() helper returns false for a number of reasons -
session in the wrong state, using EIS when a Notify method is called,
etc. Adjust the error message a bit to be more generic.
  • Loading branch information
whot authored and GeorgesStavracas committed Jul 11, 2023
1 parent 088824c commit b9693c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/remote-desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ handle_notify_pointer_motion (XdpDbusRemoteDesktop *object,
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"Session doesn't have access to a device of type: pointer");
"Session is not allowed to call NotifyPointer methods");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}

Expand Down Expand Up @@ -832,7 +832,7 @@ handle_notify_pointer_motion_absolute (XdpDbusRemoteDesktop *object,
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"Session doesn't have access to a device of type: pointer");
"Session is not allowed to call NotifyPointer methods");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}

Expand Down Expand Up @@ -900,7 +900,7 @@ handle_notify_pointer_button (XdpDbusRemoteDesktop *object,
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"Session doesn't have access to a device of type: pointer");
"Session is not allowed to call NotifyPointer methods");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}

Expand Down Expand Up @@ -963,7 +963,7 @@ handle_notify_pointer_axis (XdpDbusRemoteDesktop *object,
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"Session doesn't have access to a device of type: pointer");
"Session is not allowed to call NotifyPointer methods");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}

Expand Down Expand Up @@ -1021,7 +1021,7 @@ handle_notify_pointer_axis_discrete (XdpDbusRemoteDesktop *object,
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"Session doesn't have access to a device of type: pointer");
"Session is not allowed to call NotifyPointer methods");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}

Expand Down Expand Up @@ -1079,7 +1079,7 @@ handle_notify_keyboard_keycode (XdpDbusRemoteDesktop *object,
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"Session doesn't have access to a device of type: keyboard");
"Session is not allowed to call NotifyPointer methods");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}

Expand Down Expand Up @@ -1137,7 +1137,7 @@ handle_notify_keyboard_keysym (XdpDbusRemoteDesktop *object,
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"Session doesn't have access to a device of type: keyboard");
"Session is not allowed to call NotifyKeyboard methods");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}

Expand Down Expand Up @@ -1197,7 +1197,7 @@ handle_notify_touch_down (XdpDbusRemoteDesktop *object,
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"Session doesn't have access to a device of type: touchscreen");
"Session is not allowed to call NotifyTouch methods");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}

Expand Down Expand Up @@ -1267,7 +1267,7 @@ handle_notify_touch_motion (XdpDbusRemoteDesktop *object,
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"Session doesn't have access to a device of type: touchscreen");
"Session is not allowed to call NotifyTouch methods");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}

Expand Down Expand Up @@ -1334,7 +1334,7 @@ handle_notify_touch_up (XdpDbusRemoteDesktop *object,
g_dbus_method_invocation_return_error (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_FAILED,
"Session doesn't have access to a device of type: touchscreen");
"Session is not allowed to call NotifyTouch methods");
return G_DBUS_METHOD_INVOCATION_HANDLED;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_remotedesktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,6 @@ def test_remote_desktop_connect_to_eis_fail_notifies(self):
)
# Not the best error message but...
assert (
"Session doesn't have access to a device of type"
"Session is not allowed to call Notify"
in cm.exception.get_dbus_message()
)

0 comments on commit b9693c3

Please sign in to comment.