First attempt at functions that throw exceptions