1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:28:11 +00:00
serenity/Userland/Libraries/LibJS/Runtime/Exception.h
davidot e160f508a8 LibJS: Add a traceback to Error
Since we have the traceback we now also generate the stack string on
demand instead of immediately on construction.
2022-02-08 09:12:42 +00:00

35 lines
822 B
C++

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/FlyString.h>
#include <AK/Vector.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/Value.h>
#include <LibJS/SourceRange.h>
namespace JS {
class Exception : public Cell {
public:
explicit Exception(Value);
virtual ~Exception() override = default;
Value value() const { return m_value; }
const Vector<TracebackFrame, 32>& traceback() const { return m_traceback; }
private:
virtual const char* class_name() const override { return "Exception"; }
virtual void visit_edges(Visitor&) override;
Value m_value;
Vector<TracebackFrame, 32> m_traceback;
};
}