Hacker News new | ask | show | jobs
by dralley 1513 days ago
>"bubbling up"? What the fuck even is that?

When you throw an error and don't catch it, you just let the error immediately propagate up to the calling function. Think "return err"

>> Either by panicking on error, with .unwrap() or .expect()

This means fatally terminating the program immediately when an error is encountered in this spot.

>> or by matching it against Result::Ok / Result::Err

Result is an enum can be one of either Ok<T> or Err<E>. Pattern matching is one way of finding out which, and running code depending on which variant it is. It's just a fancy and convenient if statement, if that helps.

1 comments

Thanks. The point of my comment was not to actually ask someone to explain it to me, but again, thank you for explaining it, I appreciate it.