1 //! # Custom Errors 2 //! 3 //! Between [`ContextError`], [`Parser::context`], and [`cut_err`], 4 //! most error needs will likely be met 5 //! (see [tutorial][chapter_6]). 6 //! When that isn't the case, you can implement your own error type. 7 //! 8 //! The most basic error trait is [`ParserError`]. 9 //! 10 //! Optional traits include: 11 //! - [`AddContext`] 12 //! - [`FromExternalError`] 13 //! 14 //! # Example 15 //! 16 //!```rust 17 #![doc = include_str!("../../examples/custom_error.rs")] 18 //!``` 19 20 #![allow(unused_imports)] 21 use crate::combinator::cut_err; 22 use crate::error::ContextError; 23 use crate::Parser; 24 use crate::_tutorial::chapter_6; 25 use crate::error::AddContext; 26 use crate::error::FromExternalError; 27 use crate::error::ParserError; 28