Three failures need different evidence
A program can fail to parse, fail during execution, or finish with the wrong answer. These are different situations. Before editing, identify which one you have.
| Category | Example | Useful evidence |
|---|---|---|
| Syntax | Missing closing parenthesis | Parser message and surrounding statement |
| Runtime | Reading a property from null | Error type, stack and current input |
| Logic | Charging packing per item instead of per order | Rule, expected result and execution trace |
A program that runs but is wrong
const quantity = 2;
const unitPrice = 20;
const packingPerOrder = 5;
const incorrectTotal = (unitPrice + packingPerOrder) * quantity;
const correctTotal = unitPrice * quantity + packingPerOrder;
console.assert(incorrectTotal === 50);
console.assert(correctTotal === 45);
Both expressions execute. Only the second matches the policy. An exception handler would not detect this business mistake because no exception occurs.
Guided investigation
For a misspelled variable, inspect spelling and scope. For an incorrect total, write an independent expected amount and trace each arithmetic step. Reinstalling tools or changing unrelated code is not a useful first response to either problem.
Independent exercise
Classify these reports: a missing brace prevents execution; a customer record is null when its name is read; a 100-unit order receives a discount although the rule says strictly above 100. State the first evidence you would collect for each.
Correction
They are syntax, runtime and logic failures respectively. Inspect the syntax location, the runtime input and stack, then the boundary rule and expected amount. A reported symptom alone may be incomplete; reproduce the case before concluding where the defect lies.
Review
Use failure categories to guide your next question, not as labels to memorize. Success means explaining the cause and verifying the correction on the failing case and nearby cases.