tremor-rs / tremor-runtime

Main Tremor Project Rust Codebase
https://www.tremor.rs
Apache License 2.0
842 stars 128 forks source link

Error Handling Construct #394

Open ceosion opened 3 years ago

ceosion commented 3 years ago

Describe the problem you are trying to solve At the moment, Tremor Script does not feature a way to "catch" and respond to runtime errors/exceptions.

Describe the solution you'd like Try-Catch is already a familiar construct in many other languages, so an in-depth explanation probably isn't needed here. The gist of it is being able to execute some Tremor Script statement that has some potential to fail, and wrapping it in a block of Tremor Script that can respond to that failure in a specific way. This would be particularly helpful when dealing with blocks of Tremor Script that attempt to parse, cast, or coerce a field's value.

Licenser commented 3 years ago

Absolutely on our to-do list. A prerequisite is adding a type system and asymmetric types (so we can have an error type), errors/error handling would be a good first take on that.

It might be worth looking to implement something along the lines of rusts Result / Option type and the ? operator which is a really neat functionality halfway through always explicit and never explicit handling of errors.