Soprano 2.9.4
Public Member Functions | List of all members
Soprano::Error::Error Class Reference

Represents an error in Soprano. More...

#include <Soprano/Error/Error>

+ Inheritance diagram for Soprano::Error::Error:

Public Member Functions

 Error ()
 
 Error (const QString &message, int code=ErrorUnknown)
 
 Error (const Error &)
 
virtual ~Error ()
 
Erroroperator= (const Error &)
 
 operator bool () const
 
QString message () const
 
int code () const
 
bool isParserError () const
 
ParserError toParserError () const
 

Detailed Description

Represents an error in Soprano.

Author
Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org
See also
Error handling in Soprano

Definition at line 77 of file error.h.

Constructor & Destructor Documentation

◆ Error() [1/3]

Soprano::Error::Error::Error ( )

Create an Error object, representing success, i.e. no error.

◆ Error() [2/3]

Soprano::Error::Error::Error ( const QString message,
int  code = ErrorUnknown 
)

Create an Error object.

Parameters
messageA human-readable error message.
codeAn optional machine-readable error code. Can be one of Soprano::ErrorCode or a user defined value which has to be bigger than ErrorUnknown. The redland backend for example uses error codes ErrorUnknown + redlandCode.

◆ Error() [3/3]

Soprano::Error::Error::Error ( const Error )

Copy constructor

◆ ~Error()

virtual Soprano::Error::Error::~Error ( )
virtual

Destructor

Member Function Documentation

◆ operator=()

Error & Soprano::Error::Error::operator= ( const Error )

◆ operator bool()

Soprano::Error::Error::operator bool ( ) const
inline

An Error evalutes to a boolean, indicating if an Error is "set".

Returns
false if code() == ErrorNone, true otherwise.

Thus, an Error object can easily be checked as follows:

model.addStatement( s );
if( model.lastError() ) {
displayError( model.lastError() );
}

Definition at line 121 of file error.h.

◆ message()

QString Soprano::Error::Error::message ( ) const

A string explaining the error in detail. This string is not necessarily translated (this depends on the plugin implementation).

Returns
An error message describing the error or an empty string for no-error (i.e. success) instances.

◆ code()

int Soprano::Error::Error::code ( ) const

An error code. If the error code is ErrorNone the Error instance represents success. The code can either be one of the values of ErrorCode or a value above ErrorUnknown.

Example: The redland backend defines the error code as:

ErrorUnknown + librdf_log_message_code()
See also
ErrorCode, Error::convertErrorCode

◆ isParserError()

bool Soprano::Error::Error::isParserError ( ) const
Returns
true if this Error instance represents a parser error. In that case the error can be converted to a ParserError.

◆ toParserError()

ParserError Soprano::Error::Error::toParserError ( ) const

Converts this error into a ParserError. This has the same effect as

ParserError p1( e );
Represents an error in Soprano.
Definition error.h:78
Represents a parser error in Soprano.
Definition error.h:201
Returns
If isParserError() returns true a ParserError with a valid Locator value, otherwise a ParserError with an empty Locator.

The documentation for this class was generated from the following file: