E4127#
Type is not an error type.
MoonBit only allows error types (defined with suberror) to appear after
raise in the return type of a function.
Erroneous example#
pub fn may_raise_error() -> Unit raise String {
return
}
Suggestion#
You can wrap the type you wish to raise in an error type:
pub suberror StringError {
StringError(String)
}
pub fn may_raise_error() -> Unit raise StringError {
raise StringError("Failed")
}