class StringError

Declaration

class StringError : public ErrorInfo { /* full declaration omitted */ };

Description

This class wraps a string in an Error. StringError is useful in cases where the client is not expected to be able to consume the specific error message programmatically (for example, if the error message is to be presented to the user). StringError can also be used when additional information is to be printed along with a error_code message. Depending on the constructor called, this class can either display: 1. the error_code message (ECError behavior) 2. a string 3. the error_code message and a string These behaviors are useful when subtyping is required; for example, when a specific library needs an explicit error type. In the example below, PDBError is derived from StringError:

Declared at: llvm/include/llvm/Support/Error.h:1174

Inherits from: ErrorInfo

Member Variables

public static char ID

Method Overview

  • public StringError(std::error_code EC, const llvm::Twine & S = llvm::Twine())
  • public StringError(const llvm::Twine & S, std::error_code EC)
  • public std::error_code convertToErrorCode() const
  • public const std::string & getMessage() const
  • public void log(llvm::raw_ostream & OS) const

Methods

StringError(std::error_code EC,
            const llvm::Twine& S = llvm::Twine())

Declared at: llvm/include/llvm/Support/Error.h:1179

Parameters

std::error_code EC
const llvm::Twine& S = llvm::Twine()

StringError(const llvm::Twine& S,
            std::error_code EC)

Declared at: llvm/include/llvm/Support/Error.h:1182

Parameters

const llvm::Twine& S
std::error_code EC

std::error_code convertToErrorCode() const

Description

Convert this error to a std::error_code. This is a temporary crutch to enable interaction with code still using std::error_code. It will be removed in the future.

Declared at: llvm/include/llvm/Support/Error.h:1185

const std::string& getMessage() const

Declared at: llvm/include/llvm/Support/Error.h:1187

void log(llvm::raw_ostream& OS) const

Description

Print an error message to an output stream.

Declared at: llvm/include/llvm/Support/Error.h:1184

Parameters

llvm::raw_ostream& OS