SHARE
TWEET

Untitled

a guest Jan 16th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top