From 8d92bfdb53b595d77c89202482426b73a8f8afb8 Mon Sep 17 00:00:00 2001
From: Xavier Bergeron <xavbergeron@gmail.com>
Date: Wed, 18 Nov 2020 21:02:11 -0800
Subject: [PATCH] Add errornohalt as coroutine callback fallback

---
 lua/xlib/sh_coroutines.lua | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lua/xlib/sh_coroutines.lua b/lua/xlib/sh_coroutines.lua
index c4e44a5..5929ec9 100644
--- a/lua/xlib/sh_coroutines.lua
+++ b/lua/xlib/sh_coroutines.lua
@@ -44,6 +44,11 @@ function coro_mt:finish(...)
     self:unhook()
     if isfunction(self.callback) then
         self.callback(...)
+    else
+        local succ, msg = ...
+        if not succ then
+            ErrorNoHalt("Coroutine failed", msg)
+        end
     end
 end
 
-- 
GitLab