bcquality/microsoft/knowledge/error-handling/collect-validation-errors-with-errorbehavior.bad.al
Copilot 8901b83e07 Add error-handling knowledge domain and review leaf skill
Seed the first new AL knowledge domain toward issue #34: a fully wired
error-handling domain that the review pipeline actually consumes.

- 3 knowledge articles (+ good/bad AL samples):
  - prefer-errorinfo-for-actionable-errors (ErrorInfo Fix-it/Show-it actions)
  - collect-validation-errors-with-errorbehavior (ErrorBehavior::Collect)
  - errortype-internal-vs-client-for-diagnostics (ErrorType Internal vs Client)
- New leaf skill al-error-handling-review.md, modeled on al-performance-review
- Wire the leaf into al-code-review (sub-skills, Source, description)
- README: six -> seven leaf skills

Validated: frontmatter validator clean; knowledge-index check passes
(deterministic, full coverage, selection inputs intact).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-23 10:35:24 +02:00

21 lines
748 B
AL

codeunit 50187 "Collect Errors Bad Sample"
{
procedure ValidateAllItems()
var
Item: Record Item;
ErrorText: Text;
begin
// Hand-rolled accumulation: reimplements the platform feature, loses each
// error's ErrorInfo structure, and skips telemetry classification.
if Item.FindSet() then
repeat
if Item.Description = '' then
ErrorText += StrSubstNo('Item %1 has no description.\', Item."No.");
if Item."Unit Cost" <= 0 then
ErrorText += StrSubstNo('Item %1 must have a positive unit cost.\', Item."No.");
until Item.Next() = 0;
if ErrorText <> '' then
Error(ErrorText);
end;
}