| 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 | |
| 14 | namespace lldb_dap { |
| 15 | |
| 16 | char DAPError::ID; |
| 17 | |
| 18 | DAPError::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(message), m_ec(EC), m_show_user(show_user), m_url(url), |
| 22 | m_url_label(url_label) {} |
| 23 | |
| 24 | void DAPError::log(llvm::raw_ostream &OS) const { OS << m_message; } |
| 25 | |
| 26 | std::error_code DAPError::convertToErrorCode() const { |
| 27 | return llvm::inconvertibleErrorCode(); |
| 28 | } |
| 29 | |
| 30 | char NotStoppedError::ID; |
| 31 | |
| 32 | void NotStoppedError::log(llvm::raw_ostream &OS) const { OS << "not stopped"; } |
| 33 | |
| 34 | std::error_code NotStoppedError::convertToErrorCode() const { |
| 35 | return llvm::inconvertibleErrorCode(); |
| 36 | } |
| 37 | |
| 38 | } // namespace lldb_dap |
| 39 |
