Revise Computing
Revision notesQuestionsFor schools
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Supplementary programming practice/Defensive Design

Error messaging

301.16 Defensive Design

Practise exam questions

Defensive Design — Note 5 of 5

Friendly feedback to users.

What you need to know

Good error messages tell the user what went wrong and how to fix it. They should be clear, polite, and specific — never show raw Python tracebacks to users.

What to know

  • Tell the user WHAT went wrong
  • Tell the user HOW to fix it
  • Be specific: "Enter a number between 1 and 10" not "Invalid"
  • Never show raw tracebacks to end users

Code examples

Friendly error messages
python
mark = input("Enter mark: ")
if not mark.isdigit():
    print("Please enter a whole number.")
elif int(mark) < 0 or int(mark) > 100:
    print("Mark must be between 0 and 100.")
else:
    print("Mark recorded: " + mark)
← Previous noteValidation subprograms301.16 Defensive DesignNext topic →1D arrays301.17 Arrays and Records

Back to Defensive Design

Specification notes for programming are in Paper 2.

Defensive Design

Note 5 of 5

  1. 1Anticipate misuse
  2. 2Validation checks
  3. 3Authentication
  4. 4Validation subprograms
  5. 5Error messaging
Topic overview

© 2026 Revise Computing · revisecomputing.co.uk

Privacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).