Class ParsingException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- org.spongepowered.configurate.ConfigurateException
-
- org.spongepowered.configurate.loader.ParsingException
-
- All Implemented Interfaces:
Serializable
public class ParsingException extends ConfigurateException
Indicates an error that occurred while parsing the configuration.These exceptions can include a specific position reference within a file.
- Since:
- 4.0.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intUNKNOWN_POSIndicates a line or column is unknown.
-
Constructor Summary
Constructors Constructor Description ParsingException(int line, int column, @Nullable String context, @Nullable String message, @Nullable Throwable cause)Create a new parsing exception.ParsingException(ConfigurationNode position, int line, int column, @Nullable String context, @Nullable String message, @Nullable Throwable cause)Create a new parsing exception.ParsingException(ConfigurationNode position, int line, int column, String context, @Nullable String message)Create a new parsing exception.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcolumn()Column most closely associated with the error.@Nullable Stringcontext()A context line from the source, if available.@Nullable StringgetMessage()Get a description of the location of this error, with path included.intline()Line most closely associated with this error.static ParsingExceptionwrap(ConfigurationNode source, IOException ex)Given an unknownIOException, return it as a Configurate type.-
Methods inherited from class org.spongepowered.configurate.ConfigurateException
initPath, path, rawMessage
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
UNKNOWN_POS
public static final int UNKNOWN_POS
Indicates a line or column is unknown.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ParsingException
public ParsingException(ConfigurationNode position, int line, int column, String context, @Nullable String message)
Create a new parsing exception.- Parameters:
position- position in the node structure where the error occurredline- line with issuecolumn- column in the linecontext- the line in a file where the error occurredmessage- message describing the error- Since:
- 4.0.0
-
ParsingException
public ParsingException(int line, int column, @Nullable String context, @Nullable String message, @Nullable Throwable cause)
Create a new parsing exception.- Parameters:
line- line with issuecolumn- column in the linecontext- the line in a file where the error occurredmessage- message describing the errorcause- direct cause- Since:
- 4.0.0
-
ParsingException
public ParsingException(ConfigurationNode position, int line, int column, @Nullable String context, @Nullable String message, @Nullable Throwable cause)
Create a new parsing exception.- Parameters:
position- position in the node structure where the error occurredline- line with issuecolumn- column in the linecontext- the line in a file where the error occurredmessage- message describing the errorcause- direct cause- Since:
- 4.0.0
-
-
Method Detail
-
wrap
public static ParsingException wrap(ConfigurationNode source, IOException ex)
Given an unknownIOException, return it as a Configurate type.If the input
exis already aParsingException, this method returns the input value.- Parameters:
source- node where the source exception was thrownex- the source exception- Returns:
- an exception, either casted or wrapped
- Since:
- 4.0.0
-
line
public int line()
Line most closely associated with this error.- Returns:
- line, or
-1for unknown - Since:
- 4.0.0
-
column
public int column()
Column most closely associated with the error.- Returns:
- column, or
-1for unknown - Since:
- 4.0.0
-
context
public @Nullable String context()
A context line from the source, if available.- Returns:
- context line
- Since:
- 4.0.0
-
getMessage
public @Nullable String getMessage()
Description copied from class:ConfigurateExceptionGet a description of the location of this error, with path included.- Overrides:
getMessagein classConfigurateException- Returns:
- message
-
-