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

@@ -1,11 +1,9 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*/
#pragma once
#include <Flipper/FlipperResponder.h>
@@ -22,13 +20,13 @@ class FlipperResponderMock : public FlipperResponder {
std::vector<folly::dynamic>* errors = nullptr)
: successes_(successes), errors_(errors) {}
void success(const folly::dynamic& response) const override {
void success(const folly::dynamic& response) override {
if (successes_) {
successes_->push_back(response);
}
}
void error(const folly::dynamic& response) const override {
void error(const folly::dynamic& response) override {
if (errors_) {
errors_->push_back(response);
}