expose failure reason when flag parsing fails (#380)
This commit is contained in:
parent
36787198f7
commit
09a66cef95
2 changed files with 16 additions and 0 deletions
|
|
@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Core: Expose failure reason when flag parsing fails ([#380](https://github.com/Incendo/cloud/pull/380))
|
||||||
|
|
||||||
## [1.7.1]
|
## [1.7.1]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -483,6 +483,7 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7725389394142868549L;
|
private static final long serialVersionUID = -7725389394142868549L;
|
||||||
private final String input;
|
private final String input;
|
||||||
|
private final FailureReason failureReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new flag parse exception
|
* Construct a new flag parse exception
|
||||||
|
|
@ -504,6 +505,7 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
|
||||||
CaptionVariable.of("flag", input)
|
CaptionVariable.of("flag", input)
|
||||||
);
|
);
|
||||||
this.input = input;
|
this.input = input;
|
||||||
|
this.failureReason = failureReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -514,6 +516,17 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
|
||||||
public String getInput() {
|
public String getInput() {
|
||||||
return this.input;
|
return this.input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the reason why the flag parsing failed.
|
||||||
|
*
|
||||||
|
* @return the failure reason
|
||||||
|
* @since 1.8.0
|
||||||
|
*/
|
||||||
|
@API(status = API.Status.STABLE, since = "1.8.0")
|
||||||
|
public @NonNull FailureReason failureReason() {
|
||||||
|
return this.failureReason;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue