API server, error handling logic