xapian-core  1.4.21
Functions
serialise-error.cc File Reference

functions to convert Xapian::Error objects to strings and back More...

#include <config.h>
#include <xapian/error.h>
#include "length.h"
#include "serialise-error.h"
#include <string>
#include "xapian/errordispatch.h"
+ Include dependency graph for serialise-error.cc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

string serialise_error (const Xapian::Error &e)
 Serialise a Xapian::Error object to a string. More...
 
void unserialise_error (const string &serialised_error, const string &prefix, const string &new_context)
 Unserialise a Xapian::Error object and throw it. More...
 

Detailed Description

functions to convert Xapian::Error objects to strings and back

Definition in file serialise-error.cc.

Function Documentation

◆ serialise_error()

string serialise_error ( const Xapian::Error e)

Serialise a Xapian::Error object to a string.

Parameters
eThe Xapian::Error object to serialise.
Returns
Serialisation of e.

Definition at line 33 of file serialise-error.cc.

References encode_length(), Xapian::Error::get_context(), Xapian::Error::get_error_string(), Xapian::Error::get_msg(), and Xapian::Error::get_type().

Referenced by RemoteServer::RemoteServer(), RemoteServer::run(), and test_serialiseerror1().

◆ unserialise_error()

void unserialise_error ( const std::string &  error_string,
const std::string &  prefix,
const std::string &  new_context 
)

Unserialise a Xapian::Error object and throw it.

Note: does not return!

Parameters
error_stringThe string to unserialise.
prefixOptional prefix to prepend to the unserialised Error's msg field.
new_contextOptional context to replace the context in the error. If this is specified, any existing context will be noted in the Error's msg field.

Definition at line 48 of file serialise-error.cc.

References decode_length_and_check().

Referenced by RemoteDatabase::get_message(), and test_serialiseerror1().