Introduced ErrorHandler to catch panics and render appropriate HTTP responses and log errors.