mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 09:26:52 +01:00
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>
This commit is contained in:
parent
822cae1b27
commit
8901b83e07
12 changed files with 374 additions and 2 deletions
|
|
@ -0,0 +1,37 @@
|
|||
codeunit 50185 "Collect Errors Good Sample"
|
||||
{
|
||||
[ErrorBehavior(ErrorBehavior::Collect)]
|
||||
procedure ValidateAllItems()
|
||||
var
|
||||
Item: Record Item;
|
||||
CollectedErrors: List of [ErrorInfo];
|
||||
CollectedError: ErrorInfo;
|
||||
ErrorText: Text;
|
||||
begin
|
||||
if Item.FindSet() then
|
||||
repeat
|
||||
// Run each item in its own context so one failure does not abandon the rest.
|
||||
Codeunit.Run(Codeunit::"Collect Errors Item Check", Item);
|
||||
until Item.Next() = 0;
|
||||
|
||||
if HasCollectedErrors() then begin
|
||||
CollectedErrors := GetCollectedErrors();
|
||||
foreach CollectedError in CollectedErrors do
|
||||
ErrorText += CollectedError.Message() + '\';
|
||||
Message('The following must be fixed before posting:\%1', ErrorText);
|
||||
end;
|
||||
end;
|
||||
}
|
||||
|
||||
codeunit 50186 "Collect Errors Item Check"
|
||||
{
|
||||
TableNo = Item;
|
||||
|
||||
trigger OnRun()
|
||||
begin
|
||||
if Rec.Description = '' then
|
||||
Error('Item %1 has no description.', Rec."No.");
|
||||
if Rec."Unit Cost" <= 0 then
|
||||
Error('Item %1 must have a positive unit cost.', Rec."No.");
|
||||
end;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue