@@ -53,6 +53,7 @@ private struct AwaitingTask
5353 public Task Task ;
5454 public MethodInfo Method ;
5555 public LuauContext Context ;
56+ public Type Type ;
5657 }
5758
5859 private struct PropertyGetReflectionCache {
@@ -164,7 +165,7 @@ static void printf(LuauContext context, IntPtr thread, int style, int gameObject
164165 Debug . LogWarning ( res , logContext ) ;
165166 } else if ( style == 2 ) {
166167 // The STANDALONE here is just a test:
167- #if UNITY_STANDALONE
168+ #if UNITY_STANDALONE && ! UNITY_EDITOR
168169 Debug . LogWarning ( "[ERROR] " + res , logContext ) ;
169170#else
170171 Debug . LogError ( res , logContext ) ;
@@ -1499,6 +1500,7 @@ private static int InvokeMethodAsync(LuauContext context, IntPtr thread, Type ty
14991500 Task = task ,
15001501 Method = method ,
15011502 Context = context ,
1503+ Type = type ,
15021504 } ;
15031505
15041506 if ( task . IsCompleted ) {
@@ -1542,9 +1544,19 @@ private static void ResumeAsyncTask(AwaitingTask awaitingTask, bool immediate =
15421544 }
15431545
15441546 if ( awaitingTask . Task . IsFaulted ) {
1545- ThreadDataManager . Error ( thread ) ;
1546- Debug . LogException ( awaitingTask . Task . Exception ) ;
1547- GetLuauDebugTrace ( thread ) ;
1547+ var result = - 1 ;
1548+ try {
1549+ LuauError ( thread , $ "Error: Exception thrown in { awaitingTask . Type . Name } { awaitingTask . Method . Name } : { awaitingTask . Task . Exception . Message } ") ;
1550+ result = LuauPlugin . LuauResumeThread ( thread , - 1 ) ;
1551+ } catch ( LuauException e ) {
1552+ Debug . LogException ( e ) ;
1553+ }
1554+ if ( binding != null ) {
1555+ binding . m_asyncYield = false ;
1556+ binding . m_canResume = result == 1 ;
1557+ binding . m_error = true ;
1558+ }
1559+
15481560 return ;
15491561 }
15501562
0 commit comments