Skip to content

Commit

Permalink
Improve error messages
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman committed Jan 22, 2025
1 parent 83ea561 commit 84e9618
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ private Statement assignment(AssignmentStatementContext ctx) {
if ( isAssignmentLhsValid(left) )
return stmt(ast( binX(left, token(ctx.op), expression(ctx.right)), ctx ));

throw createParsingFailedException("Invalid assignment target -- should be a variable, index, or property expression", ctx);
throw createParsingFailedException("Invalid assignment target -- must be a variable, index, or property expression", ctx);
}

private boolean isAssignmentLhsValid(Expression left) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ private FeatureFlagNode featureFlagDeclaration(FeatureFlagDeclarationContext ctx
var value = expression(ctx.expression());
var result = ast( new FeatureFlagNode(name, value), ctx );
if( !(value instanceof ConstantExpression) )
collectSyntaxError(new SyntaxException("Feature flag value should be a literal value (number, string, true/false)", result));
collectSyntaxError(new SyntaxException("Feature flag value must be a literal value (number, string, true/false)", result));
return result;
}

Expand Down Expand Up @@ -570,7 +570,7 @@ private Statement workflowEmits(WorkflowEmitsContext ctx) {
private Statement workflowEmit(StatementContext ctx) {
var result = statement(ctx);
if( !(result instanceof ExpressionStatement) ) {
collectSyntaxError(new SyntaxException("Invalid workflow emit -- should be a name, assignment, or expression", result));
collectSyntaxError(new SyntaxException("Invalid workflow emit -- must be a name, assignment, or expression", result));
return null;
}
saveTrailingComment(result, ctx);
Expand Down Expand Up @@ -845,7 +845,7 @@ private Statement assignment(AssignmentStatementContext ctx) {
if ( isAssignmentLhsValid(left) )
return stmt(ast( new AssignmentExpression(left, token(ctx.op), expression(ctx.right)), ctx ));

throw createParsingFailedException("Invalid assignment target -- should be a variable, index, or property expression", ctx);
throw createParsingFailedException("Invalid assignment target -- must be a variable, index, or property expression", ctx);
}

private boolean isAssignmentLhsValid(Expression left) {
Expand Down

0 comments on commit 84e9618

Please sign in to comment.