OK I've changed to try/catch. There are a lot of possible ways to do the error handling so feel free to spell out your preference. I've used a `var` and `null` in this latest version because I figure we're going for optimal speed here, eschewing `Option`s and `Either`s and higher-orderness.