1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
use std::io; use serde_json; // Create the Error, ErrorKind, ResultExt, and Result types error_chain! { foreign_links { Io(io::Error); Serde(serde_json::Error); } errors { /// Chrome restricts message sizes to a maximum of 1MB MessageTooLarge(size: usize) { description("message too large") display("message too large: {} bytes", size) } NoMoreInput { description("EOF received") display("the input stream reached the end") } } }