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

Unified Diff: extensions/browser/extension_function.h

Issue 298413003: Add ErrorUtils::FormatErrorMessage() syntax to ExtensionFunction::Error(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: namespace Created 6 years, 7 months 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 | extensions/browser/extension_function.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_function.h
diff --git a/extensions/browser/extension_function.h b/extensions/browser/extension_function.h
index dca24a403409f2028a2d91aea8ef540cc5053f7b..0116193099b6f23b7d6a1d31f7db323a7271b437 100644
--- a/extensions/browser/extension_function.h
+++ b/extensions/browser/extension_function.h
@@ -145,6 +145,7 @@ class ExtensionFunction
// * RespondNow(OneArgument(42))
// * RespondNow(ArgumentList(my_result.ToValue()))
// * RespondNow(Error("Warp core breach"))
+ // * RespondNow(Error("Warp core breach on *", GetURL()))
// * RespondLater(), then later,
// * Respond(NoArguments())
// * ... etc.
@@ -264,6 +265,18 @@ class ExtensionFunction
ResponseValue ArgumentList(scoped_ptr<base::ListValue> results);
// Error. chrome.runtime.lastError.message will be set to |error|.
ResponseValue Error(const std::string& error);
+ // Error with formatting. Args are processed using
+ // ErrorUtils::FormatErrorMessage, that is, each occurence of * is replaced
+ // by the corresponding |s*|:
+ // Error("Error in *: *", "foo", "bar") <--> // Error("Error in foo: bar").
+ ResponseValue Error(const std::string& format, const std::string& s1);
+ ResponseValue Error(const std::string& format,
+ const std::string& s1,
+ const std::string& s2);
+ ResponseValue Error(const std::string& format,
+ const std::string& s1,
+ const std::string& s2,
+ const std::string& s3);
// Bad message. A ResponseValue equivalent to EXTENSION_FUNCTION_VALIDATE().
ResponseValue BadMessage();
« no previous file with comments | « no previous file | extensions/browser/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698