Re: Validating Message Parameters

Thiago Macieira <[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <13894130.5S1v2nMkd7@tjmaciei-mobl1>
On Sunday, 20 August 2017 15:22:02 PDT Lawrence D'Oliveiro wrote:
> In libdbus, when you call one of the dbus_message_new_xxx methods and
> pass something invalid for the destination, path, interface or
> method/member arguments, all you get back is a result of false, with no
> indication of what you did wrong. It is up to you to make prior calls
> as necessary to dbus_validate_{bus_name,path,interface,member} to
> ensure that all these strings have the valid form.

Or you get an assertion failure and your application crashes.

> My Python wrappers for these validation calls in DBussy
> <https://github.com/ldo/dbussy>, as with all the wrappers for calls that
> take a DBusError argument, let you omit the corresponding Python Error
> object. If you do this, they will create a temporary one internally, and
> automatically raise an exception if it gets filled in with an error
> indication. Luckily, this gives you a much better description of what
> you did wrong:
[cut]

QtDBus also pre-validates the input and provides better error messages.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

_______________________________________________
dbus mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.