Bird
0
0

You want to create a custom Problem Details type for validation errors in Spring Boot. Which two fields should you always include to follow the standard and provide useful info?

hard📝 Application Q8 of 15
Spring Boot - Exception Handling
You want to create a custom Problem Details type for validation errors in Spring Boot. Which two fields should you always include to follow the standard and provide useful info?
A"status" and "stackTrace"
B"errorCode" and "message"
C"type" and "title"
D"detail" and "timestamp"
Step-by-Step Solution
Solution:
  1. Step 1: Identify required standard fields for Problem Details

    The 'type' URI identifies the error type, and 'title' gives a short summary. Both are required for custom types.
  2. Step 2: Check other options for standard compliance

    Fields like 'errorCode', 'message', 'stackTrace', or 'timestamp' are not required or standard.
  3. Final Answer:

    "type" and "title" -> Option C
  4. Quick Check:

    Custom Problem Details need 'type' and 'title' [OK]
Quick Trick: Always include 'type' and 'title' in custom Problem Details [OK]
Common Mistakes:
  • Using non-standard fields as required
  • Omitting 'type' or 'title'
  • Adding stack trace in production errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes