buffet: Don't crash if user is passing bad parameters via D-Bus.

With this change, 'buffet_client RegisterDevice' now returns useful
information and the buffet daemon doesn't crash:

 # buffet_client RegisterDevice
 [0212/144637:ERROR:logging.h(777)] Failed to call method: org.chromium.Buffet.Manager.RegisterDevice: object_path= /org/chromium/Buffet/Manager: org.freedesktop.DBus.Error.Failed: buffet/missing_parameter:Parameter ticket_id not specified
 [0212/144637:ERROR:dbus_method_invoker.h(110)] CallMethodAndBlockWithTimeout(...): Domain=dbus, Code=org.freedesktop.DBus.Error.Failed, Message=buffet/missing_parameter:Parameter ticket_id not specified
 Failed to receive a response: buffet/missing_parameter:Parameter ticket_id not specified

BUG=brillo:193
TEST=Manually tested.

Change-Id: I70a90293f5f8226cdaaf1f5bf0fbe46b8984b23a
Reviewed-on: https://chromium-review.googlesource.com/249340
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
diff --git a/buffet/device_registration_info.h b/buffet/device_registration_info.h
index dc3524a..4c9cfaa 100644
--- a/buffet/device_registration_info.h
+++ b/buffet/device_registration_info.h
@@ -157,10 +157,17 @@
 
   void PublishStateUpdates();
 
-  void GetParamValue(
+  // Looks up the value for parameter with name |param_name| in
+  // |params|, supplying a default value if one is available and
+  // |params| doesn't have a value for |param_name|. The value will be
+  // returned in |param_value|. Returns |true| if a value was set
+  // (either from |params| or a default), |false| otherwise and
+  // |error| will be set.
+  bool GetParamValue(
     const std::map<std::string, std::string>& params,
     const std::string& param_name,
-    std::string* param_value);
+    std::string* param_value,
+    chromeos::ErrorPtr* error);
 
   // Builds Cloud API devices collection REST resouce which matches
   // current state of the device including command definitions