use quick_error::quick_error;
use std::{io, result};
quick_error! {
#[derive(Debug)]
pub enum Error {
IoError(err: io::Error) {
description("io error")
display("I/O error: {}", err)
cause(err)
from()
}
IllegalInit {
description("illegal initialization")
display("Wkhtmltopdf may not be initialized more than once per process")
}
NotInitialized {
description("not initialized")
display("Wkhtmltopdf is not currently initialized")
}
Blocked {
description("wkhtmltopdf blocked")
display("Wkhtmltopdf is currently blocked by another initialized instance")
}
ThreadMismatch(before: usize, after: usize) {
description("thread mismatch")
display("Wkhtmltopdf originally started on thread {:0x}, cannot recreate on thread {:0x}", before, after)
}
ConversionFailed(msg: String) {
description("conversion failed")
display("Conversion failed: {}", msg)
}
GlobalSettingFailure(name: String, value: String) {
description("global setting failure")
display("Failed to update global setting '{}'='{}'", name, value)
}
ObjectSettingFailure(name: String, value: String) {
description("object setting failure")
display("Failed to update object setting '{}'='{}'", name, value)
}
}
}
pub type Result<T> = result::Result<T, Error>;