Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/facett

.nornir/error-codes-for-idiots.md

facett UI error codes — for idiots

What is this?

Every broken thing in a facett screen now has a name tag, like facet-map-2. Before, a test only knew something was wrong by reading the words on screen. If you changed the words, the test went blind. Now each error has a permanent code that never changes, so tests and other apps can point at the EXACT problem.

The name tag looks like

facet-<component>-<n>
        │          │
        │          └── a number, counted per component (1, 2, 3, …), NEVER reused
        └── which facett part (map, graph3d, geomap, korp, …)

Examples: facet-map-1, facet-graph3d-2, facet-korp-1.

Two things always show up together

  1. The message — the human sentence, like "map has no vessels to plot". Same as before. Always there.
  2. The code — the name tag facet-map-2. In a normal dev (debug) build it shows on screen in bright PINK next to the message. In a shipped (release) build the pink is faint, but the code is still in the data + logs + the About popup.

How do I make one?

let e = facet_err!(map, 2, "no positions to plot");
e.render(ui);   // draws the message + the pink code

That's it. map = the part, 2 = the number, then your sentence.

Rules (do not break)

Where do I see them all?

Run facett-demo, open the Errors tab. You'll see:

There's also a Manual tab (the real facett manual) and an About popup (press the legend button) that shows the git hash and the codeberg links.

Why "korp/cases:facet-map-2"?

An app like korp can show the SAME facett part (say the map) in two places. So korp sticks its own label in front: korp/cases:facet-map-2 vs korp/analysis:facet-map-2. Same map error, two spots — now a test can tell them apart. (That wiring is Phase 2; facett just gives korp the tool.)