1*ec7d71e6SNiels Sascha Reedijk/* 2*ec7d71e6SNiels Sascha Reedijk * Copyright 2021 Haiku, Inc. All rights reserved. 3*ec7d71e6SNiels Sascha Reedijk * Distributed under the terms of the MIT License. 4*ec7d71e6SNiels Sascha Reedijk * 5*ec7d71e6SNiels Sascha Reedijk * Authors: 6*ec7d71e6SNiels Sascha Reedijk * Niels Sascha Reedijk, niels.reedijk@gmail.com 7*ec7d71e6SNiels Sascha Reedijk * 8*ec7d71e6SNiels Sascha Reedijk * Corresponds to: 9*ec7d71e6SNiels Sascha Reedijk * headers/os/support/ErrorsExt.h hrev????? 10*ec7d71e6SNiels Sascha Reedijk */ 11*ec7d71e6SNiels Sascha Reedijk 12*ec7d71e6SNiels Sascha Reedijk 13*ec7d71e6SNiels Sascha Reedijk#if __cplusplus >= 201703L 14*ec7d71e6SNiels Sascha Reedijk 15*ec7d71e6SNiels Sascha Reedijk 16*ec7d71e6SNiels Sascha Reedijk/*! 17*ec7d71e6SNiels Sascha Reedijk \file ErrorsExt.h 18*ec7d71e6SNiels Sascha Reedijk \ingroup netservices 19*ec7d71e6SNiels Sascha Reedijk \brief Defines advanced error types and error functions for the Network Services API. 20*ec7d71e6SNiels Sascha Reedijk 21*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 22*ec7d71e6SNiels Sascha Reedijk*/ 23*ec7d71e6SNiels Sascha Reedijk 24*ec7d71e6SNiels Sascha Reedijk 25*ec7d71e6SNiels Sascha Reedijknamespace BPrivate { 26*ec7d71e6SNiels Sascha Reedijk 27*ec7d71e6SNiels Sascha Reedijknamespace Network { 28*ec7d71e6SNiels Sascha Reedijk 29*ec7d71e6SNiels Sascha Reedijk 30*ec7d71e6SNiels Sascha Reedijk/*! 31*ec7d71e6SNiels Sascha Reedijk \class BError 32*ec7d71e6SNiels Sascha Reedijk \ingroup netservices 33*ec7d71e6SNiels Sascha Reedijk \brief Abstract base class for advanced error objects. 34*ec7d71e6SNiels Sascha Reedijk 35*ec7d71e6SNiels Sascha Reedijk This class defines the minimum interface for advanced error objects in 36*ec7d71e6SNiels Sascha Reedijk modern parts of the Haiku API. 37*ec7d71e6SNiels Sascha Reedijk 38*ec7d71e6SNiels Sascha Reedijk The minimum definition of an error is that it contains an \em origin and 39*ec7d71e6SNiels Sascha Reedijk a \em message. The origin should contain a string that helps a developer 40*ec7d71e6SNiels Sascha Reedijk identify the origin of the error. Common practise is to pass the 41*ec7d71e6SNiels Sascha Reedijk \c __PRETTY_FUNCTION__ from the place where the error is constructed, but 42*ec7d71e6SNiels Sascha Reedijk subclasses can have their own definitions for the origin. 43*ec7d71e6SNiels Sascha Reedijk 44*ec7d71e6SNiels Sascha Reedijk The message is a freeform message that describes the exact error condition. 45*ec7d71e6SNiels Sascha Reedijk While it is not meant as a user-facing message, when creating custom error 46*ec7d71e6SNiels Sascha Reedijk objects, take into account that a user may be confronted with a message in 47*ec7d71e6SNiels Sascha Reedijk situations where an application presents it to a user as a final resort. 48*ec7d71e6SNiels Sascha Reedijk 49*ec7d71e6SNiels Sascha Reedijk \note The advanced error objects are not used in the existing legacy Haiku 50*ec7d71e6SNiels Sascha Reedijk Kits. They are being tested for use in the modern parts of the API and are 51*ec7d71e6SNiels Sascha Reedijk therefore included in the network services kit. 52*ec7d71e6SNiels Sascha Reedijk 53*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 54*ec7d71e6SNiels Sascha Reedijk*/ 55*ec7d71e6SNiels Sascha Reedijk 56*ec7d71e6SNiels Sascha Reedijk 57*ec7d71e6SNiels Sascha Reedijk/*! 58*ec7d71e6SNiels Sascha Reedijk \fn BError::BError(const char* error) 59*ec7d71e6SNiels Sascha Reedijk \brief Constructor that sets the \a origin. 60*ec7d71e6SNiels Sascha Reedijk 61*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 62*ec7d71e6SNiels Sascha Reedijk*/ 63*ec7d71e6SNiels Sascha Reedijk 64*ec7d71e6SNiels Sascha Reedijk 65*ec7d71e6SNiels Sascha Reedijk/*! 66*ec7d71e6SNiels Sascha Reedijk \fn BError::BError(BString origin) 67*ec7d71e6SNiels Sascha Reedijk \brief Constructor that sets the \a origin. 68*ec7d71e6SNiels Sascha Reedijk 69*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 70*ec7d71e6SNiels Sascha Reedijk*/ 71*ec7d71e6SNiels Sascha Reedijk 72*ec7d71e6SNiels Sascha Reedijk 73*ec7d71e6SNiels Sascha Reedijk/*! 74*ec7d71e6SNiels Sascha Reedijk \fn virtual BError::~BError() noexcept 75*ec7d71e6SNiels Sascha Reedijk \brief Standard destructor. 76*ec7d71e6SNiels Sascha Reedijk 77*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 78*ec7d71e6SNiels Sascha Reedijk*/ 79*ec7d71e6SNiels Sascha Reedijk 80*ec7d71e6SNiels Sascha Reedijk 81*ec7d71e6SNiels Sascha Reedijk/*! 82*ec7d71e6SNiels Sascha Reedijk \fn BError::BError(const BError& other) 83*ec7d71e6SNiels Sascha Reedijk \brief Copy constructor. 84*ec7d71e6SNiels Sascha Reedijk 85*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 86*ec7d71e6SNiels Sascha Reedijk*/ 87*ec7d71e6SNiels Sascha Reedijk 88*ec7d71e6SNiels Sascha Reedijk 89*ec7d71e6SNiels Sascha Reedijk/*! 90*ec7d71e6SNiels Sascha Reedijk \fn BError::BError(BError&& other) noexcept 91*ec7d71e6SNiels Sascha Reedijk \brief Move constructor. 92*ec7d71e6SNiels Sascha Reedijk 93*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 94*ec7d71e6SNiels Sascha Reedijk*/ 95*ec7d71e6SNiels Sascha Reedijk 96*ec7d71e6SNiels Sascha Reedijk 97*ec7d71e6SNiels Sascha Reedijk/*! 98*ec7d71e6SNiels Sascha Reedijk \fn BError& BError::operator=(const BError& other) 99*ec7d71e6SNiels Sascha Reedijk \brief Copy assignment operator. 100*ec7d71e6SNiels Sascha Reedijk 101*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 102*ec7d71e6SNiels Sascha Reedijk*/ 103*ec7d71e6SNiels Sascha Reedijk 104*ec7d71e6SNiels Sascha Reedijk 105*ec7d71e6SNiels Sascha Reedijk/*! 106*ec7d71e6SNiels Sascha Reedijk \fn BError& BError::operator=(BError&& other) noexcept 107*ec7d71e6SNiels Sascha Reedijk \brief Move assignment operator. 108*ec7d71e6SNiels Sascha Reedijk 109*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 110*ec7d71e6SNiels Sascha Reedijk*/ 111*ec7d71e6SNiels Sascha Reedijk 112*ec7d71e6SNiels Sascha Reedijk 113*ec7d71e6SNiels Sascha Reedijk/*! 114*ec7d71e6SNiels Sascha Reedijk \fn virtual const char* BError::Message() const noexcept = 0 115*ec7d71e6SNiels Sascha Reedijk \brief Access the string representation of the message. 116*ec7d71e6SNiels Sascha Reedijk 117*ec7d71e6SNiels Sascha Reedijk Implementations should return a meaningful description of the error that 118*ec7d71e6SNiels Sascha Reedijk occured. The primary target audience of these messages are developers, who 119*ec7d71e6SNiels Sascha Reedijk (hopefully) see them during development, testing or in bug reports. 120*ec7d71e6SNiels Sascha Reedijk However, if it makes sense to have the error messages be instructive to 121*ec7d71e6SNiels Sascha Reedijk users too, then do not hesitate to do so. 122*ec7d71e6SNiels Sascha Reedijk 123*ec7d71e6SNiels Sascha Reedijk Implementations of this function should never return \c NULL. 124*ec7d71e6SNiels Sascha Reedijk 125*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 126*ec7d71e6SNiels Sascha Reedijk*/ 127*ec7d71e6SNiels Sascha Reedijk 128*ec7d71e6SNiels Sascha Reedijk 129*ec7d71e6SNiels Sascha Reedijk/*! 130*ec7d71e6SNiels Sascha Reedijk \fn virtual const char* BError::Origin() const noexcept 131*ec7d71e6SNiels Sascha Reedijk \brief Access the string representation of the origin of the error. 132*ec7d71e6SNiels Sascha Reedijk 133*ec7d71e6SNiels Sascha Reedijk The default implementation returns a pointer to the string that was set as 134*ec7d71e6SNiels Sascha Reedijk the origin when this object was constructed. 135*ec7d71e6SNiels Sascha Reedijk 136*ec7d71e6SNiels Sascha Reedijk Implementations of this function should never return \c NULL. 137*ec7d71e6SNiels Sascha Reedijk 138*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 139*ec7d71e6SNiels Sascha Reedijk*/ 140*ec7d71e6SNiels Sascha Reedijk 141*ec7d71e6SNiels Sascha Reedijk 142*ec7d71e6SNiels Sascha Reedijk/*! 143*ec7d71e6SNiels Sascha Reedijk \fn virtual BString BError::DebugMessage() const 144*ec7d71e6SNiels Sascha Reedijk \brief Retrieve a debug message that contains all info in this error. 145*ec7d71e6SNiels Sascha Reedijk 146*ec7d71e6SNiels Sascha Reedijk \code 147*ec7d71e6SNiels Sascha Reedijk [Origin] Message of error 148*ec7d71e6SNiels Sascha Reedijk \endcode 149*ec7d71e6SNiels Sascha Reedijk 150*ec7d71e6SNiels Sascha Reedijk \exception std::bad_alloc In the future this method may throw this 151*ec7d71e6SNiels Sascha Reedijk exception when the memory for the debug message cannot be allocated. 152*ec7d71e6SNiels Sascha Reedijk 153*ec7d71e6SNiels Sascha Reedijk \return A \ref BString object that contains the debug message. 154*ec7d71e6SNiels Sascha Reedijk 155*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 156*ec7d71e6SNiels Sascha Reedijk*/ 157*ec7d71e6SNiels Sascha Reedijk 158*ec7d71e6SNiels Sascha Reedijk 159*ec7d71e6SNiels Sascha Reedijk/*! 160*ec7d71e6SNiels Sascha Reedijk \fn void BError::WriteToStream(std::ostream& stream) const 161*ec7d71e6SNiels Sascha Reedijk \brief Write the error description to an output stream. 162*ec7d71e6SNiels Sascha Reedijk 163*ec7d71e6SNiels Sascha Reedijk The default implementation will write the output of the \ref DebugMessage() 164*ec7d71e6SNiels Sascha Reedijk method, and append a newline. 165*ec7d71e6SNiels Sascha Reedijk 166*ec7d71e6SNiels Sascha Reedijk \exception std::ios_base::failure Any error that is forwarded when writing 167*ec7d71e6SNiels Sascha Reedijk to the \a stream. 168*ec7d71e6SNiels Sascha Reedijk 169*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 170*ec7d71e6SNiels Sascha Reedijk*/ 171*ec7d71e6SNiels Sascha Reedijk 172*ec7d71e6SNiels Sascha Reedijk 173*ec7d71e6SNiels Sascha Reedijk/*! 174*ec7d71e6SNiels Sascha Reedijk \fn size_t BError::WriteToOutput(BDataIO* output) const 175*ec7d71e6SNiels Sascha Reedijk \brief Write the error description to an output. 176*ec7d71e6SNiels Sascha Reedijk 177*ec7d71e6SNiels Sascha Reedijk The default implementation will use the output from \ref DebugMessage() 178*ec7d71e6SNiels Sascha Reedijk and write it to the \a output, including a newline and the NUL that 179*ec7d71e6SNiels Sascha Reedijk terminates the string. 180*ec7d71e6SNiels Sascha Reedijk 181*ec7d71e6SNiels Sascha Reedijk \exception BSystemError For any error that occurs when calling 182*ec7d71e6SNiels Sascha Reedijk \ref BDataIO::Write() 183*ec7d71e6SNiels Sascha Reedijk 184*ec7d71e6SNiels Sascha Reedijk \returns The number of bytes that was written to \a output. 185*ec7d71e6SNiels Sascha Reedijk 186*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 187*ec7d71e6SNiels Sascha Reedijk*/ 188*ec7d71e6SNiels Sascha Reedijk 189*ec7d71e6SNiels Sascha Reedijk 190*ec7d71e6SNiels Sascha Reedijk/*! 191*ec7d71e6SNiels Sascha Reedijk \class BRuntimeError 192*ec7d71e6SNiels Sascha Reedijk \ingroup netservices 193*ec7d71e6SNiels Sascha Reedijk \brief Advanced error object for runtime errors. 194*ec7d71e6SNiels Sascha Reedijk 195*ec7d71e6SNiels Sascha Reedijk A \ref BRuntimeError is a concrete advanced error object that is used for 196*ec7d71e6SNiels Sascha Reedijk errors that happen during a program's execution and that by their nature 197*ec7d71e6SNiels Sascha Reedijk are outside of the scope of the control of the program. 198*ec7d71e6SNiels Sascha Reedijk 199*ec7d71e6SNiels Sascha Reedijk Objects of this class store strings to the \em origin and the error 200*ec7d71e6SNiels Sascha Reedijk \em message. This class can be used as an error class or as a base to 201*ec7d71e6SNiels Sascha Reedijk create more specialized error types. 202*ec7d71e6SNiels Sascha Reedijk 203*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 204*ec7d71e6SNiels Sascha Reedijk*/ 205*ec7d71e6SNiels Sascha Reedijk 206*ec7d71e6SNiels Sascha Reedijk 207*ec7d71e6SNiels Sascha Reedijk/*! 208*ec7d71e6SNiels Sascha Reedijk \fn BRuntimeError::BRuntimeError(const char* origin, const char* message) 209*ec7d71e6SNiels Sascha Reedijk \brief Constructor for a new error object. 210*ec7d71e6SNiels Sascha Reedijk 211*ec7d71e6SNiels Sascha Reedijk \param origin A string representing where this error occured. It is advised 212*ec7d71e6SNiels Sascha Reedijk to initialize it to \c __PRETTY_FUNCTION__ by default. 213*ec7d71e6SNiels Sascha Reedijk \param message A string explaining the contents for the error. While it is 214*ec7d71e6SNiels Sascha Reedijk generally geared towards the developer, it may be useful to make the 215*ec7d71e6SNiels Sascha Reedijk error understandable by a user, as they may sometimes see it. 216*ec7d71e6SNiels Sascha Reedijk 217*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 218*ec7d71e6SNiels Sascha Reedijk*/ 219*ec7d71e6SNiels Sascha Reedijk 220*ec7d71e6SNiels Sascha Reedijk 221*ec7d71e6SNiels Sascha Reedijk/*! 222*ec7d71e6SNiels Sascha Reedijk \fn BRuntimeError::BRuntimeError(const char* origin, BString message) 223*ec7d71e6SNiels Sascha Reedijk \copydoc BRuntimeError::BRuntimeError(const char* origin, const char* message) 224*ec7d71e6SNiels Sascha Reedijk*/ 225*ec7d71e6SNiels Sascha Reedijk 226*ec7d71e6SNiels Sascha Reedijk 227*ec7d71e6SNiels Sascha Reedijk/*! 228*ec7d71e6SNiels Sascha Reedijk \fn BRuntimeError::BRuntimeError(BString origin, BString message) 229*ec7d71e6SNiels Sascha Reedijk \copydoc BRuntimeError::BRuntimeError(const char* origin, const char* message) 230*ec7d71e6SNiels Sascha Reedijk*/ 231*ec7d71e6SNiels Sascha Reedijk 232*ec7d71e6SNiels Sascha Reedijk 233*ec7d71e6SNiels Sascha Reedijk/*! 234*ec7d71e6SNiels Sascha Reedijk \fn BRuntimeError::BRuntimeError(const BRuntimeError& other) 235*ec7d71e6SNiels Sascha Reedijk \brief Copy constructor. 236*ec7d71e6SNiels Sascha Reedijk 237*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 238*ec7d71e6SNiels Sascha Reedijk*/ 239*ec7d71e6SNiels Sascha Reedijk 240*ec7d71e6SNiels Sascha Reedijk 241*ec7d71e6SNiels Sascha Reedijk/*! 242*ec7d71e6SNiels Sascha Reedijk \fn BRuntimeError::BRuntimeError(BRuntimeError&& other) noexcept 243*ec7d71e6SNiels Sascha Reedijk \brief Move constructor. 244*ec7d71e6SNiels Sascha Reedijk 245*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 246*ec7d71e6SNiels Sascha Reedijk*/ 247*ec7d71e6SNiels Sascha Reedijk 248*ec7d71e6SNiels Sascha Reedijk 249*ec7d71e6SNiels Sascha Reedijk/*! 250*ec7d71e6SNiels Sascha Reedijk \fn BRuntimeError& BRuntimeError::operator=(const BRuntimeError& other) 251*ec7d71e6SNiels Sascha Reedijk \brief Copy assignment operator. 252*ec7d71e6SNiels Sascha Reedijk 253*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 254*ec7d71e6SNiels Sascha Reedijk*/ 255*ec7d71e6SNiels Sascha Reedijk 256*ec7d71e6SNiels Sascha Reedijk 257*ec7d71e6SNiels Sascha Reedijk/*! 258*ec7d71e6SNiels Sascha Reedijk \fn BRuntimeError& BRuntimeError::operator=(BRuntimeError&& other) noexcept 259*ec7d71e6SNiels Sascha Reedijk \brief Move assignment operator. 260*ec7d71e6SNiels Sascha Reedijk 261*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 262*ec7d71e6SNiels Sascha Reedijk*/ 263*ec7d71e6SNiels Sascha Reedijk 264*ec7d71e6SNiels Sascha Reedijk 265*ec7d71e6SNiels Sascha Reedijk/*! 266*ec7d71e6SNiels Sascha Reedijk \fn virtual const char* BRuntimeError::Message() const B_CXX_NOEXCEPT B_CXX_OVERRIDE 267*ec7d71e6SNiels Sascha Reedijk \brief Get a pointer to the message describing the runtime error. 268*ec7d71e6SNiels Sascha Reedijk*/ 269*ec7d71e6SNiels Sascha Reedijk 270*ec7d71e6SNiels Sascha Reedijk 271*ec7d71e6SNiels Sascha Reedijk/*! 272*ec7d71e6SNiels Sascha Reedijk \class BSystemError 273*ec7d71e6SNiels Sascha Reedijk \ingroup netservices 274*ec7d71e6SNiels Sascha Reedijk \brief Advanced error object that wrap low-level system errors. 275*ec7d71e6SNiels Sascha Reedijk 276*ec7d71e6SNiels Sascha Reedijk A \ref BSystemError is a concrete advanced error object that is used to 277*ec7d71e6SNiels Sascha Reedijk wrap tradition errors that are usually returned as a \c status_t. This type 278*ec7d71e6SNiels Sascha Reedijk takes the system error, and adds an \em origin specifier. 279*ec7d71e6SNiels Sascha Reedijk 280*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 281*ec7d71e6SNiels Sascha Reedijk*/ 282*ec7d71e6SNiels Sascha Reedijk 283*ec7d71e6SNiels Sascha Reedijk 284*ec7d71e6SNiels Sascha Reedijk/*! 285*ec7d71e6SNiels Sascha Reedijk \fn BSystemError::BSystemError(const char* origin, status_t error) 286*ec7d71e6SNiels Sascha Reedijk \brief Create an object for \a error code with a specified \a origin. 287*ec7d71e6SNiels Sascha Reedijk 288*ec7d71e6SNiels Sascha Reedijk \param origin A string representing where this error occured. As this 289*ec7d71e6SNiels Sascha Reedijk object usually wraps around a lower level API call, this should 290*ec7d71e6SNiels Sascha Reedijk usually be the call that the error code originated from. 291*ec7d71e6SNiels Sascha Reedijk \param error The error code. 292*ec7d71e6SNiels Sascha Reedijk 293*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 294*ec7d71e6SNiels Sascha Reedijk*/ 295*ec7d71e6SNiels Sascha Reedijk 296*ec7d71e6SNiels Sascha Reedijk 297*ec7d71e6SNiels Sascha Reedijk/*! 298*ec7d71e6SNiels Sascha Reedijk \fn BSystemError::BSystemError(BString origin, status_t error) 299*ec7d71e6SNiels Sascha Reedijk \copydoc BSystemError::BSystemError(const char* origin, status_t error) 300*ec7d71e6SNiels Sascha Reedijk*/ 301*ec7d71e6SNiels Sascha Reedijk 302*ec7d71e6SNiels Sascha Reedijk 303*ec7d71e6SNiels Sascha Reedijk/*! 304*ec7d71e6SNiels Sascha Reedijk \fn BSystemError::BSystemError(const BSystemError& other) 305*ec7d71e6SNiels Sascha Reedijk \brief Copy constructor. 306*ec7d71e6SNiels Sascha Reedijk 307*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 308*ec7d71e6SNiels Sascha Reedijk*/ 309*ec7d71e6SNiels Sascha Reedijk 310*ec7d71e6SNiels Sascha Reedijk 311*ec7d71e6SNiels Sascha Reedijk/*! 312*ec7d71e6SNiels Sascha Reedijk \fn BSystemError::BSystemError(BSystemError&& other) noexcept 313*ec7d71e6SNiels Sascha Reedijk \brief Move constructor. 314*ec7d71e6SNiels Sascha Reedijk 315*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 316*ec7d71e6SNiels Sascha Reedijk*/ 317*ec7d71e6SNiels Sascha Reedijk 318*ec7d71e6SNiels Sascha Reedijk 319*ec7d71e6SNiels Sascha Reedijk/*! 320*ec7d71e6SNiels Sascha Reedijk \fn BSystemError& BSystemError::operator=(const BSystemError& other) 321*ec7d71e6SNiels Sascha Reedijk \brief Copy assignment. 322*ec7d71e6SNiels Sascha Reedijk 323*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 324*ec7d71e6SNiels Sascha Reedijk*/ 325*ec7d71e6SNiels Sascha Reedijk 326*ec7d71e6SNiels Sascha Reedijk 327*ec7d71e6SNiels Sascha Reedijk/*! 328*ec7d71e6SNiels Sascha Reedijk \fn BSystemError& BSystemError::operator=(BSystemError&& other) noexcept 329*ec7d71e6SNiels Sascha Reedijk \brief Move assignment operator. 330*ec7d71e6SNiels Sascha Reedijk 331*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 332*ec7d71e6SNiels Sascha Reedijk*/ 333*ec7d71e6SNiels Sascha Reedijk 334*ec7d71e6SNiels Sascha Reedijk 335*ec7d71e6SNiels Sascha Reedijk/*! 336*ec7d71e6SNiels Sascha Reedijk \fn virtual const char* BSystemError::Message() const B_CXX_NOEXCEPT B_CXX_OVERRIDE 337*ec7d71e6SNiels Sascha Reedijk \brief Access the string representation of the message. 338*ec7d71e6SNiels Sascha Reedijk 339*ec7d71e6SNiels Sascha Reedijk This returns the value of \c strerror() for the error code. 340*ec7d71e6SNiels Sascha Reedijk 341*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 342*ec7d71e6SNiels Sascha Reedijk*/ 343*ec7d71e6SNiels Sascha Reedijk 344*ec7d71e6SNiels Sascha Reedijk 345*ec7d71e6SNiels Sascha Reedijk/*! 346*ec7d71e6SNiels Sascha Reedijk \fn virtual BString BSystemError::DebugMessage() const B_CXX_OVERRIDE 347*ec7d71e6SNiels Sascha Reedijk \brief Retrieve a debug message that contains all info in this error. 348*ec7d71e6SNiels Sascha Reedijk 349*ec7d71e6SNiels Sascha Reedijk \code 350*ec7d71e6SNiels Sascha Reedijk [Origin] Message of error (error code) 351*ec7d71e6SNiels Sascha Reedijk \endcode 352*ec7d71e6SNiels Sascha Reedijk 353*ec7d71e6SNiels Sascha Reedijk \exception std::bad_alloc In the future this method may throw this 354*ec7d71e6SNiels Sascha Reedijk exception when the memory for the debug message cannot be allocated. 355*ec7d71e6SNiels Sascha Reedijk 356*ec7d71e6SNiels Sascha Reedijk \return A \ref BString object that contains the debug message. 357*ec7d71e6SNiels Sascha Reedijk 358*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 359*ec7d71e6SNiels Sascha Reedijk*/ 360*ec7d71e6SNiels Sascha Reedijk 361*ec7d71e6SNiels Sascha Reedijk 362*ec7d71e6SNiels Sascha Reedijk/*! 363*ec7d71e6SNiels Sascha Reedijk \fn status_t BSystemError::Error() B_CXX_NOEXCEPT 364*ec7d71e6SNiels Sascha Reedijk \brief Get the error code for this error. 365*ec7d71e6SNiels Sascha Reedijk 366*ec7d71e6SNiels Sascha Reedijk \since Haiku R1 367*ec7d71e6SNiels Sascha Reedijk*/ 368*ec7d71e6SNiels Sascha Reedijk 369*ec7d71e6SNiels Sascha Reedijk 370*ec7d71e6SNiels Sascha Reedijk} // namespace Network 371*ec7d71e6SNiels Sascha Reedijk 372*ec7d71e6SNiels Sascha Reedijk} // namespace BPrivate 373*ec7d71e6SNiels Sascha Reedijk 374*ec7d71e6SNiels Sascha Reedijk#endif 375