error.rs: Add documentation

This commit is contained in:
Matthias Beyer 2016-01-21 21:31:48 +01:00
parent 434a766536
commit cfa8c29eaf

View file

@ -4,6 +4,9 @@ use std::fmt::Formatter;
use std::fmt::Error as FmtError; use std::fmt::Error as FmtError;
use std::clone::Clone; use std::clone::Clone;
/**
* Kind of store error
*/
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub enum StoreErrorKind { pub enum StoreErrorKind {
FileError, FileError,
@ -35,6 +38,9 @@ impl Display for StoreErrorKind {
} }
/**
* Store error type
*/
#[derive(Debug)] #[derive(Debug)]
pub struct StoreError { pub struct StoreError {
err_type: StoreErrorKind, err_type: StoreErrorKind,
@ -43,6 +49,9 @@ pub struct StoreError {
impl StoreError { impl StoreError {
/**
* Build a new StoreError from an StoreErrorKind, optionally with cause
*/
pub fn new(errtype: StoreErrorKind, cause: Option<Box<Error>>) pub fn new(errtype: StoreErrorKind, cause: Option<Box<Error>>)
-> StoreError -> StoreError
{ {
@ -52,6 +61,9 @@ impl StoreError {
} }
} }
/**
* Get the error type of this StoreError
*/
pub fn err_type(&self) -> StoreErrorKind { pub fn err_type(&self) -> StoreErrorKind {
self.err_type.clone() self.err_type.clone()
} }