radon icon indicating copy to clipboard operation
radon copied to clipboard

[Feature]: `raise` keyword support proposal. (REP-6)

Open Almas-Ali opened this issue 1 year ago • 2 comments

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:

  • [x] Add raise keyword support.
  • [ ] Add raisable errors.

Examples:

  • [ ] ValueError
  • [ ] TypeError
  • [ ] KeyError
  • [ ] IndexError
  • [ ] MemoryError
  • [ ] IOError
  • [ ] NotFound 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 avatar Apr 19 '24 20:04 Almas-Ali

Converting this to a proposal. Radon Enhancement Proposal (REP-6)

Almas-Ali avatar Apr 20 '24 12:04 Almas-Ali

Added raise keyword support. #135

Almas-Ali avatar May 25 '24 11:05 Almas-Ali

Added raisable builtin in stdlib/radiation #140 This supports a list of error types.

Almas-Ali avatar May 26 '24 14:05 Almas-Ali

Also user defined radiation errors are possible.

fun MyError(message=null) -> message

raise MyError
raise MyError("This is my error")

Almas-Ali avatar May 26 '24 14:05 Almas-Ali

This ends up this REP for now. We don’t have OOP fully supported yet. We will move to OOP model in the future.

Almas-Ali avatar May 26 '24 14:05 Almas-Ali