v8 12.4.254 (node 22.4.1)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
v8-exception.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_EXCEPTION_H_
6#define INCLUDE_V8_EXCEPTION_H_
7
8#include <stddef.h>
9
10#include "v8-local-handle.h" // NOLINT(build/include_directory)
11#include "v8config.h" // NOLINT(build/include_directory)
12
13namespace v8 {
14
15class Context;
16class Isolate;
17class Message;
18class StackTrace;
19class String;
20class Value;
21
22namespace internal {
23class Isolate;
24class ThreadLocalTop;
25} // namespace internal
26
32 public:
34 Local<Value> options = {});
36 Local<Value> options = {});
38 Local<Value> options = {});
40 Local<Value> options = {});
42 Local<Value> options = {});
44 Local<Value> options = {});
46 Local<Value> options = {});
47 static Local<Value> Error(Local<String> message, Local<Value> options = {});
48
54 static Local<Message> CreateMessage(Isolate* isolate, Local<Value> exception);
55
61};
62
67 public:
73 explicit TryCatch(Isolate* isolate);
74
79
83 bool HasCaught() const;
84
93 bool CanContinue() const;
94
107 bool HasTerminated() const;
108
117
123
129 Local<Context> context, Local<Value> exception);
130
137 Local<Context> context) const;
138
144
155 void Reset();
156
165 void SetVerbose(bool value);
166
170 bool IsVerbose() const;
171
177 void SetCaptureMessage(bool value);
178
179 TryCatch(const TryCatch&) = delete;
180 void operator=(const TryCatch&) = delete;
181
182 private:
183 // Declaring operator new and delete as deleted is not spec compliant.
184 // Therefore declare them private instead to disable dynamic alloc
185 void* operator new(size_t size);
186 void* operator new[](size_t size);
187 void operator delete(void*, size_t);
188 void operator delete[](void*, size_t);
189
201 internal::Address JSStackComparableAddressPrivate() {
202 return js_stack_comparable_address_;
203 }
204
205 void ResetInternal();
206
207 internal::Isolate* i_isolate_;
208 TryCatch* next_;
209 void* exception_;
210 void* message_obj_;
211 internal::Address js_stack_comparable_address_;
212 bool is_verbose_ : 1;
213 bool can_continue_ : 1;
214 bool capture_message_ : 1;
215 bool rethrow_ : 1;
216
217 friend class internal::Isolate;
218 friend class internal::ThreadLocalTop;
219};
220
221} // namespace v8
222
223#endif // INCLUDE_V8_EXCEPTION_H_
static Local< Value > WasmCompileError(Local< String > message, Local< Value > options={})
static Local< Value > WasmLinkError(Local< String > message, Local< Value > options={})
static Local< Value > SyntaxError(Local< String > message, Local< Value > options={})
static Local< Value > WasmRuntimeError(Local< String > message, Local< Value > options={})
static Local< Value > TypeError(Local< String > message, Local< Value > options={})
static Local< Message > CreateMessage(Isolate *isolate, Local< Value > exception)
static Local< StackTrace > GetStackTrace(Local< Value > exception)
static Local< Value > Error(Local< String > message, Local< Value > options={})
static Local< Value > RangeError(Local< String > message, Local< Value > options={})
static Local< Value > ReferenceError(Local< String > message, Local< Value > options={})
Local< Value > Exception() const
Local< v8::Message > Message() const
TryCatch(const TryCatch &)=delete
bool CanContinue() const
Local< Value > ReThrow()
bool HasCaught() const
void operator=(const TryCatch &)=delete
void SetCaptureMessage(bool value)
bool IsVerbose() const
static V8_WARN_UNUSED_RESULT MaybeLocal< Value > StackTrace(Local< Context > context, Local< Value > exception)
V8_WARN_UNUSED_RESULT MaybeLocal< Value > StackTrace(Local< Context > context) const
bool HasTerminated() const
void SetVerbose(bool value)
TryCatch(Isolate *isolate)
uintptr_t Address
Definition v8-internal.h:31
#define V8_EXPORT
Definition v8config.h:753
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:628