Error invocation using text constant (LC0048)
When calling Error() with a message, use a Label variable instead of a text constant. Labels support localization and provide better consistency across the codebase.
Example
The following code uses a text constant in Error:
codeunit 50100 MyCodeunit
{
procedure ValidateAmount(Amount: Decimal)
begin
if Amount < 0 then
Error('Amount cannot be negative'); // Error invocation using text constant [LC0048]
end;
}
To fix this, use a Label variable:
codeunit 50100 MyCodeunit
{
var
AmountCannotBeNegativeErr: Label 'Amount cannot be negative';
procedure ValidateAmount(Amount: Decimal)
begin
if Amount < 0 then
Error(AmountCannotBeNegativeErr);
end;
}