[Feature]: `raise` keyword support proposal. (REP-6)
Closed this issue · 5 comments
Almas-Ali commented
Is your feature request related to a problem? Please describe.
It will make Radon more powerful.
Describe the solution you'd like
A sample example.
try {
1/0
}
catch as err {
raise some error
}
Work List:
- Add
raise
keyword support. - Add raisable errors.
Examples:
-
ValueError
-
TypeError
-
KeyError
-
IndexError
-
MemoryError
-
IOError
-
NotImplementedError
etc more... - For making this multiple errors, we need to make a
BaseError
class that will be inherited by child classes to make new errors. Also custom (user defined) errors will be supported.
This issue will be edited for any future changes.
Almas-Ali commented
Converting this to a proposal. Radon Enhancement Proposal (REP-6)
Almas-Ali commented
Added raisable builtin in stdlib/radiation
#140
This supports a list of error types.
Almas-Ali commented
Also user defined radiation errors are possible.
fun MyError(message=null) -> message
raise MyError
raise MyError("This is my error")
Almas-Ali commented
This ends up this REP for now. We don’t have OOP fully supported yet. We will move to OOP model in the future.