Linting rules
E030: throw-requires-documented-error-value
Requires documentation for enum values used as `throw` codes.
Metadata
Code:E030Rule:throw-requires-documented-error-valueStatus: Preview sincev0.0.1Quick fix: not available
What it does
Requires documentation for enum values used as throw codes.
Why is this bad?
Symbolic exit codes become part of the contract interface. Without a short note on the enum value, callers and tests can see the name but not the exact failure condition it represents.
Behavior notes
- This preview rule is disabled (
allow) by default. Enable it in config:
[lint.rules]
throw-requires-documented-error-value = "warn"- Or run only this rule with
acton check --enable-only E030. - The documentation must be a non-empty
///doc comment immediately above the enum value.
Example
enum Errors {
NotOwner = 401
}
fun onInternalMessage(in: InMessage) {
// ...
assert (in.senderAddress == storage.ownerAddress) throw Errors.NotOwner;
}Use instead:
enum Errors {
/// Sender is not the current owner.
NotOwner = 401
}
fun onInternalMessage(in: InMessage) {
// ...
assert (in.senderAddress == storage.ownerAddress) throw Errors.NotOwner;
}Last updated on