enhance error management for API Servlet.