Guest User

Untitled

a guest
Jan 16th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. use std::error::Error;
  2.  
  3. mod lua {
  4. use std::fmt;
  5.  
  6. #[derive(Debug)]
  7. pub struct Error;
  8.  
  9. impl fmt::Display for Error {
  10. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  11. f.write_str("Lua error")
  12. }
  13. }
  14.  
  15. impl std::error::Error for Error {}
  16. }
  17.  
  18. fn foo() -> Result<(), Box<dyn Error>> {
  19. bar()?;
  20. baz()?;
  21. Ok(())
  22. }
  23.  
  24. fn bar() -> Result<(), url::ParseError> {
  25. Ok(())
  26. }
  27.  
  28. fn baz() -> Result<(), lua::Error> {
  29. Ok(())
  30. }
Add Comment
Please, Sign In to add comment