Urdl C++ Library

PrevUpHomeNext
istream::error

Gets the last error associated with the stream.

const boost::system::error_code & error() const;

Return Value

An error_code corresponding to the last error from the stream.

Remarks

Returns a reference to an error_code object representing the last failure reported by an istreambuf function. The set of possible error_code values and categories depends on the protocol of the URL used to open the stream.

Example

To take action given a specific error:

urdl::istream is("http://somesite/page");
if (!is)
{
  if (is.error() == urdl::http::errc::forbidden)
  {
    std::cout << "Computer says no" << std::endl;
  }
}

PrevUpHomeNext