boo-lang / boo

The Boo Programming Language.
BSD 3-Clause "New" or "Revised" License
874 stars 148 forks source link

Unhandled exceptions in async methods don't activate a `ensure` block #166

Closed masonwheeler closed 7 years ago

masonwheeler commented 7 years ago
import System
import System.Threading.Tasks

[async]
def test() as Task[of string]:
    try:
        await Task.Delay(100)
        raise "Error!"
    ensure:
        print "Ensure block"

try:
    print test().Result
except ae as AggregateException:
    for ex in ae.InnerExceptions:
        print ex.Message

Expected: Ensure block Error!

Observed: Error!

masonwheeler commented 7 years ago

Fixed by https://github.com/boo-lang/boo/commit/a604624cd3569afaccb74d40fde67aa2e3e90fda