Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Unified Diff: headless/lib/browser/devtools_api/domain_cc.template

Issue 2539833002: Deliver errors from devtools API calls to callbacks (Closed)
Patch Set: Addressed review comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | headless/lib/browser/headless_devtools_client_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/devtools_api/domain_cc.template
diff --git a/headless/lib/browser/devtools_api/domain_cc.template b/headless/lib/browser/devtools_api/domain_cc.template
index 88f28b1f56a2d15ba60301d3e761a2dfe9050670..3345a4ad565a73e0291f7c92ed61cab543d04bc1 100644
--- a/headless/lib/browser/devtools_api/domain_cc.template
+++ b/headless/lib/browser/devtools_api/domain_cc.template
@@ -102,6 +102,11 @@ void {{class_name}}::{{method_name}}(std::unique_ptr<{{method_name}}Params> para
void Domain::Handle{{method_name}}Response(base::Callback<void(std::unique_ptr<{{method_name}}Result>)> callback, const base::Value& response) {
if (callback.is_null())
return;
+ // This is an error response.
+ if (response.IsType(base::Value::TYPE_NULL)) {
+ callback.Run(nullptr);
+ return;
+ }
ErrorReporter errors;
std::unique_ptr<{{method_name}}Result> result = {{method_name}}Result::Parse(response, &errors);
DCHECK(!errors.HasErrors());
« no previous file with comments | « no previous file | headless/lib/browser/headless_devtools_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698