KDE 4.5 PyKDE API Reference

- KDE's Python API

# Error Class Reference

`from PyKDE4.soprano import *`

Subclasses: Soprano.Error.ParserError
Namespace: Soprano.Error

## Detailed Description

\class Error error.h Soprano/Error/Error

Represents an error in %Soprano.

Author:
  Sebastian Trueg <trueg@kde.org>

\sa soprano_error_handling

## Methods
| __init__ (self)
| __init__ (self, QString message, int code=Soprano.Error.ErrorUnknown)
| __init__ (self, Soprano.Error.Error a0)
int | code (self)
bool | isParserError (self)
QString | message (self)
Soprano.Error.ParserError | toParserError (self)

## Method Documentation

__init__ | ( |  | self ) |

\cond protected_error_members

__init__ | ( | self, |
|  | QString | message,
|  | int | code=Soprano.Error.ErrorUnknown
| ) |  |  |

Create an Error object.

Parameters:

  | message | A human-readable error message.

Parameters:

  | code | An 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 <i>ErrorUnknown + redlandCode</i>.

__init__ | ( | self, |
|  | Soprano.Error.Error | a0
| ) |  |  |

\cond protected_error_members

int code | ( |  | self ) |

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()

\sa ErrorCode, Error.convertErrorCode

bool isParserError | ( |  | self ) |

Returns:
  true if this Error instance represents a parser error. In that case the error can be converted to a ParserError.

QString message | ( |  | self ) |

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.

Soprano.Error.ParserError toParserError | ( |  | self ) |

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

     Error e;
     ParserError p1( e );

Returns:
  If isParserError() returns true a ParserError with a valid Locator value, otherwise a ParserError with an empty Locator.