Enclosing error throwing into single fn