FlipperResponder: no response = success

Summary:
If an exception is thrown from the plugin, FlipperClient.cpp will catch it and respond with an error response.
If the object goes out of scope with no response being returned, then return a success response in the destructor.

Reviewed By: passy

Differential Revision: D14024259

fbshipit-source-id: 52e419dd23fc3882e8b92b593e8c1e1ea90e2b26
This commit is contained in:
John Knox
2019-02-13 05:09:40 -08:00
committed by Facebook Github Bot
parent dfbd12cd63
commit ff076d9dcd
5 changed files with 58 additions and 20 deletions

View File

@@ -27,13 +27,13 @@ class FireAndForgetBasedFlipperResponder : public FlipperResponder {
int64_t responseID)
: socket_(socket), responseID_(responseID) {}
void success(const folly::dynamic& response) const override {
void success(const folly::dynamic& response) override {
const folly::dynamic message =
folly::dynamic::object("id", responseID_)("success", response);
socket_->sendMessage(message);
}
void error(const folly::dynamic& response) const override {
void error(const folly::dynamic& response) override {
const folly::dynamic message =
folly::dynamic::object("id", responseID_)("error", response);
socket_->sendMessage(message);