mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Supply arguments in flag parse exceptions
This commit is contained in:
parent
6c070b4c23
commit
1e7e019d25
@ -1,19 +1,21 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.flags;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Caption;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.CaptionUtility;
|
||||
|
||||
public class FlagParseException extends Exception {
|
||||
|
||||
private final PlotFlag<?, ?> flag;
|
||||
private final String value;
|
||||
private final Caption errorMessage;
|
||||
private final String errorMessage;
|
||||
|
||||
public FlagParseException(final PlotFlag<?, ?> flag, final String value, final Caption errorMessage) {
|
||||
public FlagParseException(final PlotFlag<?, ?> flag, final String value, final Caption errorMessage,
|
||||
final Object ... args) {
|
||||
super(String.format("Failed to parse flag of type '%s'. Value '%s' was not accepted.",
|
||||
flag.getName(), value));
|
||||
this.flag = flag;
|
||||
this.value = value;
|
||||
this.errorMessage = errorMessage;
|
||||
this.errorMessage = CaptionUtility.format(errorMessage, args);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,7 +36,8 @@ public class FlagParseException extends Exception {
|
||||
return this.flag;
|
||||
}
|
||||
|
||||
public Caption getErrorMessage() {
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user