t27.aiEnglish

Горячие клавиши и чтение ошибки

Вы узнаете

Как читать сообщение об ошибке по частям и четыре горячие клавиши, которые экономят время.

Сообщение об ошибке похоже на шум, но в нём 4 части, всегда в одном порядке: вид ошибки, что она говорит, файл и строка. Строка - это место, где проблему заметили, поэтому причина может быть чуть выше: начинайте читать с 1 строки раньше. Держите под рукой 4 горячие клавиши: Cmd+S сохраняет, Cmd+Z отменяет, Ctrl+C останавливает программу в терминале, а стрелка вверх возвращает прошлую команду. Когда просите агента о помощи, вставьте сообщение целиком, а не пересказ.

Попробуйте

В спеке найдите ERROR_LINE и START_LINE. Поставьте START_LINE равным 15 и запустите плеер: упадёт тест, который требует начинать на одну строку выше ошибки. Затем верните 13.

Открыть интерактивный урок →

Vibecoding 6: the four parts of an error ↗

An error message split into its four parts, in the order you read them, and where to start reading. Lesson 6 of the vibecoding course.

specs/vibecoding/read_an_error.t27

// SPDX-License-Identifier: Apache-2.0
; specs/vibecoding/read_an_error.t27 -- lesson 6 of the vibecoding course: shortcuts, and reading an error
; An error message has four parts, and they come in the same order every time you read it:
; what kind of error, what it says, which file, which line. The line is where the problem was
; noticed, so the cause can sit just above it: open from one line before.
; ASCII only (L3), English only (LANG-EN).
; phi^2 + 1/phi^2 = 3 | TRINITY

module vc_read_an_error;

pub const PART_COUNT : u8 = 4;
pub const PARTS : [4]str = ["kind", "message", "file", "line"];

; Four shortcuts worth knowing on day one (Cmd on a Mac, Ctrl elsewhere).
pub const SHORTCUT_COUNT : u8 = 4;
pub const SHORTCUTS : [4]str = ["Cmd+S", "Cmd+Z", "Ctrl+C", "Up arrow"];
pub const SHORTCUT_MEANINGS : [4]str = [
    "save the file",
    "undo the last edit",
    "stop a program running in the terminal",
    "bring back the previous command"
];

; An error was reported at this line; read from one line before it.
pub const ERROR_LINE : u8 = 14;
pub const START_LINE : u8 = 13;

test an_error_has_four_parts_and_the_line_comes_last {
    assert PART_COUNT == 4;
    assert PARTS[0] == "kind";
    assert PARTS[3] == "line";
}

test four_shortcuts_each_with_a_meaning {
    assert SHORTCUT_COUNT == 4;
    assert SHORTCUTS[2] == "Ctrl+C";
    assert SHORTCUT_MEANINGS[2] == "stop a program running in the terminal";
    assert SHORTCUT_MEANINGS[3] == "bring back the previous command";
}

test start_reading_one_line_above_the_reported_line {
    assert START_LINE == ERROR_LINE - 1;
    assert START_LINE < ERROR_LINE;
}

Открыть спеку урока в плеере ↗

Все уроки