v8 10.2.154 (node 18.16.0)
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:
41
47 static Local<Message> CreateMessage(Isolate* isolate, Local<Value> exception);
48
54};
55
60 public:
66 explicit TryCatch(Isolate* isolate);
67
72
76 bool HasCaught() const;
77
86 bool CanContinue() const;
87
100 bool HasTerminated() const;
101
110
116
122 Local<Context> context, Local<Value> exception);
123
130 Local<Context> context) const;
131
137
148 void Reset();
149
158 void SetVerbose(bool value);
159
163 bool IsVerbose() const;
164
170 void SetCaptureMessage(bool value);
171
172 TryCatch(const TryCatch&) = delete;
173 void operator=(const TryCatch&) = delete;
174
175 private:
176 // Declaring operator new and delete as deleted is not spec compliant.
177 // Therefore declare them private instead to disable dynamic alloc
178 void* operator new(size_t size);
179 void* operator new[](size_t size);
180 void operator delete(void*, size_t);
181 void operator delete[](void*, size_t);
182
194 internal::Address JSStackComparableAddressPrivate() {
195 return js_stack_comparable_address_;
196 }
197
198 void ResetInternal();
199
200 internal::Isolate* isolate_;
201 TryCatch* next_;
202 void* exception_;
203 void* message_obj_;
204 internal::Address js_stack_comparable_address_;
205 bool is_verbose_ : 1;
206 bool can_continue_ : 1;
207 bool capture_message_ : 1;
208 bool rethrow_ : 1;
209 bool has_terminated_ : 1;
210
211 friend class internal::Isolate;
212 friend class internal::ThreadLocalTop;
213};
214
215} // namespace v8
216
217#endif // INCLUDE_V8_EXCEPTION_H_
static Local< Value > WasmCompileError(Local< String > message)
static Local< Value > RangeError(Local< String > message)
static Local< Value > ReferenceError(Local< String > message)
static Local< Value > SyntaxError(Local< String > message)
static Local< Message > CreateMessage(Isolate *isolate, Local< Value > exception)
static Local< Value > TypeError(Local< String > message)
static Local< Value > WasmLinkError(Local< String > message)
static Local< StackTrace > GetStackTrace(Local< Value > exception)
static Local< Value > Error(Local< String > message)
static Local< Value > WasmRuntimeError(Local< String > message)
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:29
#define V8_EXPORT
Definition v8config.h:578
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:499