Bird
0
0

How would you improve this error response to be more human-readable?

hard📝 Application Q9 of 15
Rest API - Error Handling

How would you improve this error response to be more human-readable?

{"code": 403, "error": "Forbidden", "info": "Access denied"}
A{"status": "error", "message": 403}
B{"code": 403, "error": 403, "message": "Access denied"}
C{"code": 403, "error": "Forbidden", "message": "You do not have permission to access this resource"}
D{"error": "Access denied"}
Step-by-Step Solution
Solution:
  1. Step 1: Identify missing clarity in message

    Current "info" is vague; a detailed message helps users understand the problem.
  2. Step 2: Replace "info" with a clear "message" field

    {"code": 403, "error": "Forbidden", "message": "You do not have permission to access this resource"} provides a full sentence explaining the access denial.
  3. Final Answer:

    {"code": 403, "error": "Forbidden", "message": "You do not have permission to access this resource"} -> Option C
  4. Quick Check:

    Detailed message improves readability [OK]
Quick Trick: Use full sentences for error messages [OK]
Common Mistakes:
  • Using numeric error instead of string
  • Omitting detailed explanation
  • Using unclear keys like "info"

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes