better errors for api