public class SyntaxException
extends GroovyException
Base exception class indicating a syntax error detected during parsing. Captures source location information (line and column numbers) where the error occurred to facilitate debugging and error reporting.
| Constructor and description |
|---|
SyntaxException(String message, ASTNode node)Constructs a SyntaxException from an AST node's position information. |
SyntaxException(String message, int startLine, int startColumn)Constructs a SyntaxException with line and column information. |
SyntaxException(String message, int startLine, int startColumn, int endLine, int endColumn)Constructs a SyntaxException with complete position range information. |
SyntaxException(String message, Throwable cause, int startLine, int startColumn)Constructs a SyntaxException with a cause exception. |
SyntaxException(String message, Throwable cause, int startLine, int startColumn, int endLine, int endColumn)Constructs a SyntaxException with a cause exception and complete position information. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public int |
getEndColumn()Returns the ending column number of the error. |
|
public int |
getEndLine()Returns the ending line number of the error. |
|
public int |
getLine()Returns the starting line number of the error. |
|
public String |
getMessage()Returns the error message with location information appended. |
|
public String |
getOriginalMessage()Returns the original error message without location information. |
|
public String |
getSourceLocator()Returns the optional source locator string. |
|
public int |
getStartColumn()Returns the starting column number of the error. |
|
public int |
getStartLine()Returns the starting line number of the error. |
|
public void |
setSourceLocator(String sourceLocator)Sets an optional source locator string (e.g., file path, URL). |
| Methods inherited from class | Name |
|---|---|
class GroovyException |
isFatal, setFatal |
Constructs a SyntaxException from an AST node's position information.
message - the error messagenode - the ASTNode where the error occurredConstructs a SyntaxException with line and column information. The end position defaults to one column after the start position.
message - the error messagestartLine - the line number where the error starts (1-based)startColumn - the column number where the error starts (1-based)Constructs a SyntaxException with complete position range information.
message - the error messagestartLine - the line number where the error starts (1-based)startColumn - the column number where the error starts (1-based)endLine - the line number where the error ends (1-based)endColumn - the column number where the error ends (1-based)Constructs a SyntaxException with a cause exception. The end position defaults to one column after the start position.
message - the error messagecause - the underlying Throwable that caused this exceptionstartLine - the line number where the error starts (1-based)startColumn - the column number where the error starts (1-based)Constructs a SyntaxException with a cause exception and complete position information.
message - the error messagecause - the underlying Throwable that caused this exceptionstartLine - the line number where the error starts (1-based)startColumn - the column number where the error starts (1-based)endLine - the line number where the error ends (1-based)endColumn - the column number where the error ends (1-based)Returns the ending column number of the error.
Returns the ending line number of the error.
Returns the starting line number of the error. Provided for backward compatibility; equivalent to getStartLine().
Returns the error message with location information appended.
Returns the original error message without location information.
Returns the optional source locator string.
null if not setReturns the starting column number of the error.
Returns the starting line number of the error.
Sets an optional source locator string (e.g., file path, URL).
sourceLocator - the source location identifierCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.