use std::io;
use scoped_error::{Context, Error, expect_error};
fn parse_url(url: &str) -> io::Result<()> {
let _ = url;
Err(io::Error::other("invalid URL format"))
}
fn connect(url: &str) -> Result<String, Error> {
parse_url(url).context("failed to parse url")?;
Ok("hello".to_string())
}
fn main() -> Result<(), Error> {
expect_error("This program will error", || {
connect("")?;
Ok(())
})
}