GCSE · Computer Science · Eduqas · Spec C500QS

Error diagnostics

Your program falls over. Read every line hunting for the problem, or let the environment tell you what is wrong and where?

Computer Science · Software development

Press Run and read what it tells you

This till program should print the cost of a small shop. Press Run, read what comes back, then choose how to repair the program. Run it again after each change.

Python
  1. # Shop till
  2. price = 4
  3. quantity = 3
  4. discount = 2
  5. subtotal = price * quantity
  6. total = subtotal - discount
  7. print("Items:", quantity)
  8. print("Total cost:", totl)
  9. print("Thank you")

The messages and outputs are what Python 3.13 gives for this exact code. Other languages and environments word their messages differently.

Computer Science · Error diagnostics

Take the message apart

Sort each fragment of a message by the job it does for the programmer.

Still to sort

Tells you WHAT went wrong (0)

The kind or cause of the error.

Where the line is: If it names the kind of error or the cause, it is a 'what'. If it gives a place, it is not.

Tells you WHERE (0)

The place in the code, such as a line number.

Where the line is: If it points to a place in the code, it is a 'where'. If it only describes the problem, it is a 'what'.

Neither (0)

Sounds like a message, but gives you nothing to act on.

Where the line is: If you could not use it to find the error or choose a fix, it does neither job.

7 of 7 still to sort.

Every fragment below is doing a job. Which one?

Error diagnostics

?

Reason it through

Why does a diagnostic save a programmer time and effort?

Link 1 of 4

First link · your turn

The environment finds an error in the code. What does the programmer get to see?

2
Locked — reveal the link above first
3
Locked — reveal the link above first
4
Locked — reveal the link above first

Computer Science · Error diagnostics

What happens after the message appears?

Maya has written part of a program. She presses Run and the environment shows her an error diagnostic.

Which is closest to what you think happens next?
How sure are you?

Computer Science · Error diagnostics

Explain it in your own words

Explain how error diagnostics help a programmer to find and fix errors. [5 marks]

0 words · your answer stays on this page and is not sent anywhere.

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

The message that tells you what went wrong, and where.

What you need to know

  • Error diagnostics are a tool in a software development environment, such as an IDE. They help you write and test code.
  • When the environment finds an error in your code, it reports it with a message. That message is an error diagnostic.
  • The message usually says what went wrong, giving the kind or cause of the error.
  • Have a goMaya's program stops and shows: NameError: name 'scroe' is not defined. She groans: 'That tells me nothing!' Is she right?

    No. It names the kind of error (NameError) and the cause: the name 'scroe' is not defined.

    A diagnostic usually describes what went wrong, so even a short message gives you the kind or cause of the error.

  • It usually also says where: for example, the line number the error was found on.
  • The 'where' lets you go straight to that place instead of searching the whole program.
  • Have a goYour program is 200 lines long. The message says the error was found on line 87. Where do you look first?

    Line 87. You do not start at line 1.

    The message points to where the error was found, so you go there instead of searching all 200 lines.

  • The 'what' shows what needs correcting, so you can choose the right fix.
  • Put together, what and where cut the time and effort needed to find and correct errors.
  • A diagnostic reports the problem. It does not repair it: you decide on the fix and make it.
  • Have a goSam presses Run, reads a NameError message and cheers: 'Brilliant, it has fixed itself!' What has Sam missed?

    The message only reports the error. Nothing has changed until Sam edits the code.

    A diagnostic says what went wrong and where. Making the correction is still the programmer's job.

  • You can use diagnostics while you are writing and testing code, not only at the end.

The big picture

Error diagnostics are messages from a software development environment that report errors found in your code. A message usually says what went wrong and where, so you can go straight to the place and know what to correct. That cuts the time and effort of finding and fixing errors.

Key points

1Error diagnostics are messages from the development environment that report errors found in your code.
2A message usually says what went wrong (the kind or cause) and where (for example, the line number).
3The 'where' takes you straight to the error. The 'what' shows what needs correcting.
4Diagnostics reduce the time and effort needed to find and correct errors. The programmer still makes the fix.

Worked example

Problem

Your program stops with this message. Use it to find and fix the error. IndentationError: expected an indented block after 'for' statement on line 2 (reported at line 3) 1 names = ["Asha", "Ben", "Cai"] 2 for n in names: 3 print("Hi", n)

⚠ Watch out

Expecting the environment to repair the code, or ignoring the message and searching the whole program anyway. The message reports what went wrong and where. You choose and make the fix.

🧠

Memory hook

What + where = no wandering. The message points; you fix.

✓

Check yourself

Imagine your environment only ever said 'Something went wrong.' Which two jobs would the message be missing, and what would you have to do instead?

Flashcards

(10)
Where do error diagnostics come from?
From a software development environment, such as an IDE. It provides them to support the programmer when writing and testing code.
What is an error diagnostic?
A message that reports an error which has been found in a program's code.
What does the 'what' half of a diagnostic give you?
A description of what went wrong: usually the kind or cause of the error.
What does the 'where' half of a diagnostic give you?
The place in the code where the error was found, for example the line number.
A program has 200 lines and one error. How does a diagnostic save you reading them all?
Its message points to where the error was found, so you go straight there instead of searching the whole program.
How does the description in a diagnostic help you fix an error?
What went wrong indicates what needs to be corrected.
Why do diagnostics save time and effort?
By reporting what the error is and where it is, they cut the time and effort needed to find and correct errors during development.
Does an error diagnostic fix your code for you?
No. It reports the error. The programmer decides on the correction and makes it.
When can a programmer use error diagnostics?
During development: while writing and testing code, not only once it is finished.
A message reads IndexError: list index out of range, line 9. Which part is the 'what' and which is the 'where'?
What: IndexError, list index out of range. Where: line 9.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More Eduqas GCSE Computer Science topics

See the full Eduqas Computer Science curriculum →

How this lesson was checked. This Eduqas GCSE Computer Science (specification C500QS)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 15 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.