added error handling to categories routing solution