Package dev.omnist.schema
Class OsdParseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
dev.omnist.schema.OsdParseException
- All Implemented Interfaces:
Serializable
Thrown when OSD (Omnist Schema Definition) text fails to parse (omnist-spec §5).
Callers that need to surface parse errors to users should inspect:
getLine()andgetColumn()— source locationgetCode()— a machine-readable error code (e.g.schema.duplicate-record)getPath()— the schema element path where the error was detected (e.g. a record name)Throwable.getMessage()— human-readable explanation combining all of the above
This exception is thrown by OsdReader and OsdLexer for any structural,
constraint, or lexical violation detected during parsing.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOsdParseException(int line, int column, String message) Constructs a parse exception with default codeschema.parse-errorand path"$".OsdParseException(int line, int column, String code, String path, String message) Constructs a fully-detailed parse exception. -
Method Summary
Modifier and TypeMethodDescriptiongetCode()Returns the machine-readable error code identifying the violation category, e.g.intReturns the 1-based column number in the OSD source where the error was detected.intgetLine()Returns the 1-based line number in the OSD source where the error was detected.getPath()Returns the schema-path to the element that triggered the error, e.g. a record name, a field path such as"MyRecord.myField", or"$"for root-level errors.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
OsdParseException
Constructs a fully-detailed parse exception.- Parameters:
line- 1-based line number in the OSD source where the error was detectedcolumn- 1-based column number in the OSD source where the error was detectedcode- machine-readable error code identifying the violation category (e.g.schema.duplicate-record,schema.unknown-type)path- schema-path to the element that triggered the error (e.g. a record name or field path); use"$"when the error is at the schema rootmessage- human-readable description of the error
-
OsdParseException
Constructs a parse exception with default codeschema.parse-errorand path"$". Convenience constructor for generic lexical errors fromOsdLexer.- Parameters:
line- 1-based line number where the error was detectedcolumn- 1-based column number where the error was detectedmessage- human-readable description of the error
-
-
Method Details
-
getLine
public int getLine()Returns the 1-based line number in the OSD source where the error was detected. -
getColumn
public int getColumn()Returns the 1-based column number in the OSD source where the error was detected. -
getCode
Returns the machine-readable error code identifying the violation category, e.g.schema.duplicate-recordorschema.unknown-type. -
getPath
Returns the schema-path to the element that triggered the error, e.g. a record name, a field path such as"MyRecord.myField", or"$"for root-level errors.
-