LYR-SEM0137
a type named twice in one 'throws' set
A function's 'throws [ … ]' list names the same error type more than once.
Explanation
A throws clause is a set of error types; each one stands in it once. A repeated entry is usually a copy-paste slip, or a different type was meant.
Remove the duplicate, or name the type that was intended.
Wrong
enum Oops :: [Error] {
Bad;
fn message(): string { return "oops"; }
}
fn f(): int throws [Oops, Oops] { return 1; }
fn main(): void {
let _ = try? f();
}
Right
enum Oops :: [Error] {
Bad;
fn message(): string { return "oops"; }
}
fn f(): int throws Oops { return 1; }
fn main(): void {
let _ = try? f();
}