electron/shell/common/gin_helper/error_thrower.h
electron-roller[bot] 9d0e6d09f0
chore: bump chromium to 119.0.6043.0 (main) (#40045)
* chore: bump chromium in DEPS to 119.0.6036.0

* chore: bump chromium in DEPS to 119.0.6037.0

* chore: bump chromium in DEPS to 119.0.6039.0

* chore: bump chromium in DEPS to 119.0.6041.0

* chore: update chromium patches

* 4765230: Move //content/browser/renderer_host/event_with_latency_info.h to //content/common/input | https://chromium-review.googlesource.com/c/chromium/src/+/4765230

* 4890325: ScopedRunLoopTimeout: add custom timeout callback handler for testing | https://chromium-review.googlesource.com/c/chromium/src/+/4890325

* chore: update all patches

* chore: bump chromium in DEPS to 119.0.6043.0

* 4898682: [api] Add Error.cause to V8 API

https://chromium-review.googlesource.com/c/v8/v8/+/4898682

* 4837192: Plumb origin through for drags.

https://chromium-review.googlesource.com/c/chromium/src/+/4837192

* Prevent content analysis on web pages that don't accept drag and drop.

https://chromium-review.googlesource.com/c/chromium/src/+/4814086

* Make getting displayed notifications work with notification attribution.

https://chromium-review.googlesource.com/c/chromium/src/+/4738935

* 4898682: [api] Add Error.cause to V8 API

https://chromium-review.googlesource.com/c/v8/v8/+/4898682

* lib,test: do not hardcode Buffer.kMaxLength

https://github.com/nodejs/node/pull/49876

* chore: remove Goma warning from mksnapshot_args

* 4776412: Remove Windows-specific wstring variants of StringPrintf() etc.

https://chromium-review.googlesource.com/c/chromium/src/+/4776412

* [dPWA] Prevent WebAppInstallInfo from being included on Android

https://chromium-review.googlesource.com/c/chromium/src/+/4886594

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-10-02 18:01:07 -04:00

38 lines
1.2 KiB
C++

// Copyright (c) 2019 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_ERROR_THROWER_H_
#define ELECTRON_SHELL_COMMON_GIN_HELPER_ERROR_THROWER_H_
#include "base/memory/raw_ptr.h"
#include "base/strings/string_piece.h"
#include "v8/include/v8.h"
namespace gin_helper {
class ErrorThrower {
public:
explicit ErrorThrower(v8::Isolate* isolate);
ErrorThrower();
~ErrorThrower() = default;
void ThrowError(base::StringPiece err_msg) const;
void ThrowTypeError(base::StringPiece err_msg) const;
void ThrowRangeError(base::StringPiece err_msg) const;
void ThrowReferenceError(base::StringPiece err_msg) const;
void ThrowSyntaxError(base::StringPiece err_msg) const;
v8::Isolate* isolate() const { return isolate_; }
private:
using ErrorGenerator = v8::Local<v8::Value> (*)(v8::Local<v8::String> err_msg,
v8::Local<v8::Value> options);
void Throw(ErrorGenerator gen, base::StringPiece err_msg) const;
raw_ptr<v8::Isolate> isolate_;
};
} // namespace gin_helper
#endif // ELECTRON_SHELL_COMMON_GIN_HELPER_ERROR_THROWER_H_