1//===-- DAPError.cpp ------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "DAPError.h"
10#include "llvm/Support/Error.h"
11#include "llvm/Support/raw_ostream.h"
12#include <system_error>
13
14namespace lldb_dap {
15
16char DAPError::ID;
17
18DAPError::DAPError(std::string message, std::error_code EC, bool show_user,
19 std::optional<std::string> url,
20 std::optional<std::string> url_label)
21 : m_message(std::move(message)), m_ec(EC), m_show_user(show_user),
22 m_url(std::move(url)), m_url_label(std::move(url_label)) {}
23
24void DAPError::log(llvm::raw_ostream &OS) const { OS << m_message; }
25
26std::error_code DAPError::convertToErrorCode() const { return m_ec; }
27
28char NotStoppedError::ID;
29
30void NotStoppedError::log(llvm::raw_ostream &OS) const { OS << "not stopped"; }
31
32std::error_code NotStoppedError::convertToErrorCode() const {
33 return llvm::inconvertibleErrorCode();
34}
35
36} // namespace lldb_dap
37

source code of lldb/tools/lldb-dap/DAPError.cpp