Returning better error info to function callers