[#6530] Refactor error handling into context manager

- Also allows exc to propagate up so task will end in error state

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>