re-export ErrorKind

This commit is contained in:
Ashley Mannix
2017-05-29 12:51:43 +10:00
committed by Paul Masurel
parent e8fc4c77e2
commit 6a9a71bb1b
2 changed files with 13 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
/// Definition of Tantivy's error and result.
//! Definition of Tantivy's error and result.
use std::io;
@@ -12,37 +12,48 @@ use serde_json;
error_chain!(
errors {
/// Path does not exist.
PathDoesNotExist(buf: PathBuf) {
description("path does not exist")
display("path does not exist: '{:?}'", buf)
}
/// File already exists, this is a problem when we try to write into a new file.
FileAlreadyExists(buf: PathBuf) {
description("file already exists")
display("file already exists: '{:?}'", buf)
}
/// IO Error.
IOError(err: IOError) {
description("an IO error occurred")
display("an IO error occurred: '{}'", err)
}
/// The data within is corrupted.
///
/// For instance, it contains invalid JSON.
CorruptedFile(buf: PathBuf) {
description("file contains corrupted data")
display("file contains corrupted data: '{:?}'", buf)
}
/// A thread holding the locked panicked and poisoned the lock.
Poisoned {
description("a thread holding the locked panicked and poisoned the lock")
}
/// Invalid argument was passed by the user.
InvalidArgument(arg: String) {
description("an invalid argument was passed")
display("an invalid argument was passed: '{}'", arg)
}
/// An Error happened in one of the thread.
ErrorInThread(err: String) {
description("an error occurred in a thread")
display("an error occurred in a thread: '{}'", err)
}
/// An Error appeared related to the lack of a field.
SchemaError(field: String) {
description("a schema field is missing")
display("a schema field is missing: '{}'", field)
}
/// Tried to access a fastfield reader for a field not configured accordingly.
FastFieldError(err: FastFieldNotAvailableError) {
description("fast field not available")
display("fast field not available: '{:?}'", err)

View File

@@ -86,7 +86,7 @@ mod functional_test;
#[macro_use]
mod macros;
pub use error::Error;
pub use error::{Error, ErrorKind};
/// Tantivy result.
pub type Result<T> = std::result::Result<T, Error>;