Let's say you have a function which reads in a file, converts it into a script, and returns a Result. It takes one argument: the name of the file to load.
struct Script;
type ParseError = Box<dyn std::error::Error>;
fn load_script(_filename: &str) -> Result<Script, ParseError> {
// open file, parse data, return Err(ParseError) on failure