Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/JsValue.cpp

Issue 29497620: Noissue - don't throw a pointer to an exception in C++ (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created July 25, 2017, 2:53 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsValue.cpp
diff --git a/src/JsValue.cpp b/src/JsValue.cpp
index d0cfbddfde2785799f19130adec1d1e632bb8f32..159453a2a5ecf0b4e4dcd420fe700a3ab3b91974 100644
--- a/src/JsValue.cpp
+++ b/src/JsValue.cpp
@@ -165,7 +165,7 @@ AdblockPlus::JsValueList AdblockPlus::JsValue::AsList() const
std::vector<std::string> AdblockPlus::JsValue::GetOwnPropertyNames() const
{
if (!IsObject())
- throw new std::runtime_error("Attempting to get propert list for a non-object");
+ throw std::runtime_error("Attempting to get propert list for a non-object");
const JsContext context(*jsEngine);
v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(UnwrapValue());
@@ -180,7 +180,7 @@ std::vector<std::string> AdblockPlus::JsValue::GetOwnPropertyNames() const
AdblockPlus::JsValue AdblockPlus::JsValue::GetProperty(const std::string& name) const
{
if (!IsObject())
- throw new std::runtime_error("Attempting to get property of a non-object");
+ throw std::runtime_error("Attempting to get property of a non-object");
const JsContext context(*jsEngine);
v8::Local<v8::String> property = Utils::ToV8String(jsEngine->GetIsolate(), name);
@@ -191,7 +191,7 @@ AdblockPlus::JsValue AdblockPlus::JsValue::GetProperty(const std::string& name)
void AdblockPlus::JsValue::SetProperty(const std::string& name, v8::Handle<v8::Value> val)
{
if (!IsObject())
- throw new std::runtime_error("Attempting to set property on a non-object");
+ throw std::runtime_error("Attempting to set property on a non-object");
v8::Local<v8::String> property = Utils::ToV8String(jsEngine->GetIsolate(), name);
v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(UnwrapValue());
@@ -236,7 +236,7 @@ void AdblockPlus::JsValue::SetProperty(const std::string& name, bool val)
std::string AdblockPlus::JsValue::GetClass() const
{
if (!IsObject())
- throw new std::runtime_error("Cannot get constructor of a non-object");
+ throw std::runtime_error("Cannot get constructor of a non-object");
const JsContext context(*jsEngine);
v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(UnwrapValue());
@@ -278,9 +278,9 @@ JsValue JsValue::Call(const JsValue& arg) const
JsValue JsValue::Call(std::vector<v8::Handle<v8::Value>>& args, v8::Local<v8::Object> thisObj) const
{
if (!IsFunction())
- throw new std::runtime_error("Attempting to call a non-function");
+ throw std::runtime_error("Attempting to call a non-function");
if (!thisObj->IsObject())
- throw new std::runtime_error("`this` pointer has to be an object");
+ throw std::runtime_error("`this` pointer has to be an object");
const JsContext context(*jsEngine);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld