Added basic error reporting to API