Trying to get better error handling