# 10.1 Anatomy of a diagnostic

> A diagnostic is not a sentence: it is a piece of data with a stable code, a class, a severity and a position. The message you read is built afterwards, in your language.

Web page: https://pseudolearn.app/en/spec/diagnosticos/anatomia

> **In one sentence**
>
> A diagnostic is not a sentence: it is a piece of data with a stable code, a class, a severity and a position. The message you read is built afterwards, in your language.

## 10.1.1 How it works

Every diagnostic has these parts:

| Part | What it is |
| --- | --- |
| code | a stable name, the same in every language |
| class | lexical, syntactic, semantic or runtime |
| severity | error, warning or information |
| span | where it starts and ends in the text |
| related | other spans that help understand it |
| arguments | the concrete data: a name, a type, a number |

**Figure 10.1-1: Data and message**

At the top, the diagnostic as data: code incompatibleTypesInAssignment, semantic class and error severity, span on line 2 and arguments expected Integer and found String. An arrow with the language template leads to the presented message.

The same diagnostic seen as data and as a message. The message is built with a template in the interface language and the arguments.

### Program: A diagnostic with arguments

```pseudolearn
Algorithm Mezcla
  Define total As Integer <- "diez";
  Write total;
EndAlgorithm
```

**Diagnostics**
- `incompatibleTypesInAssignment` (error, 2:3): Incompatible types in assignment: cannot assign string to integer

*The program finishes with an error.*

The data carries no text. To show it, the interface looks up the code's template in its language and fills in the arguments. That is why the message prose can be in English while the program uses the Spanish profile: user names are never translated, and the language's words appear in the active profile.

[Appendix C](https://pseudolearn.app/en/spec/apendice/diagnosticos.md) lists every code with its class, severity and message.

**In short**
- A diagnostic is data: code, class, severity, span and arguments.
- The message is built afterwards, with the language's template.
- The code does not change with the language.

**See also**
- [10.2 Severity and classes](https://pseudolearn.app/en/spec/diagnosticos/severidad.md)
- [1.6 Errors, warnings and failures](https://pseudolearn.app/en/spec/vision/errores.md)
- [C.1 Diagnostic catalogue](https://pseudolearn.app/en/spec/apendice/diagnosticos.md)
