-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release 0.9.2 #17
Release 0.9.2 #17
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,7 +164,14 @@ private void TriggerEnter(IStateInternal state) | |
} | ||
catch (Exception e) | ||
{ | ||
throw new Exception($"Exception in the state {state.Name}, OnEnter() actions.\n" + CreationStackTrace, e); | ||
var finalMessage = ""; | ||
#if UNITY_EDITOR || DEBUG | ||
finalMessage = $"\nStackTrace log of '{state.Name}' state creation bellow.\n{CreationStackTrace}"; | ||
#endif | ||
|
||
Debug.LogError($"Exception in the state '{state.Name}', OnExit() actions.\n" + | ||
$"-->> Check the exception log after this one for more details <<-- {finalMessage}"); | ||
Debug.LogException(e); | ||
} | ||
} | ||
|
||
|
@@ -180,7 +187,14 @@ private void TriggerExit() | |
} | ||
catch(Exception e) | ||
{ | ||
throw new Exception($"Exception in the state '{Name}', OnExit() actions.\n" + CreationStackTrace, e); | ||
var finalMessage = ""; | ||
#if UNITY_EDITOR || DEBUG | ||
finalMessage = $"\nStackTrace log of '{Name}' state creation bellow.\n{CreationStackTrace}"; | ||
#endif | ||
|
||
Debug.LogError($"Exception in the state '{Name}', OnExit() actions.\n" + | ||
$"-->> Check the exception log after this one for more details <<-- {finalMessage}"); | ||
Debug.LogException(e); | ||
Comment on lines
+190
to
+197
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
} | ||
|
||
|
@@ -199,8 +213,14 @@ private void TriggerTransition(ITransitionInternal transition, string eventName) | |
} | ||
catch (Exception e) | ||
{ | ||
throw new Exception($"Exception in the transition '{Name}' -> '{transition.TargetState?.Name}'," + | ||
$" TriggerTransition() actions.\n{transition.CreationStackTrace}", e); | ||
var finalMessage = ""; | ||
#if UNITY_EDITOR || DEBUG | ||
finalMessage = $"\nStackTrace log of this transition creation bellow.\n{transition.CreationStackTrace}"; | ||
#endif | ||
|
||
Debug.LogError($"Exception in the transition '{Name}' -> '{transition.TargetState?.Name}'" + | ||
$"-->> Check the exception log after this one for more details <<-- {finalMessage}"); | ||
Debug.LogException(e); | ||
Comment on lines
+216
to
+223
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another catch block has been modified to log the exception using Overall, the changes improve error visibility in the Unity console. However, it's important to review the error messages and ensure they provide clear and relevant information for debugging purposes. Additionally, be cautious about logging sensitive information in the exception object. |
||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,8 +143,15 @@ private async Task InnerTaskAwait(string eventName) | |
} | ||
catch (Exception e) | ||
{ | ||
throw new Exception($"Exception in the state '{Name}', when calling the task wait action " + | ||
$"'{_taskAwaitAction.Target}.{_taskAwaitAction.Method.Name}()'.\n" + CreationStackTrace, e); | ||
var finalMessage = ""; | ||
#if UNITY_EDITOR || DEBUG | ||
finalMessage = $"\nStackTrace log of '{Name}' state creation bellow.\n{CreationStackTrace}"; | ||
#endif | ||
|
||
Debug.LogError($"Exception in the state '{Name}', when calling the task wait action" + | ||
$"'{_taskAwaitAction.Target}.{_taskAwaitAction.Method.Name}()'.\n" + | ||
$"-->> Check the exception log after this one for more details <<-- {finalMessage}"); | ||
Debug.LogException(e); | ||
Comment on lines
+146
to
+154
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The exception handling in this code has been modified. Instead of throwing a new exception with a detailed message and stack trace, the code now logs an error message using While the change improves error visibility in the Unity console, it removes the ability to catch and handle the exception at a higher level. This may limit the flexibility of error handling and make it harder to debug issues that occur during the task wait action. Consider the following suggestions:
Debug.LogError($"Exception of type {e.GetType()} occurred in the state '{Name}', when calling the task wait action " +
$"'{_taskAwaitAction.Target}.{_taskAwaitAction.Method.Name}()'.\n" +
$"-->> Check the exception log after this one for more details <<-- {finalMessage}");
Debug.LogError($"Exception in the state '{Name}', when calling the task wait action " +
$"'{_taskAwaitAction.Target}.{_taskAwaitAction.Method.Name}()'.\n" +
$"-->> Check the exception log after this one for more details <<-- {finalMessage}");
Debug.LogException(e);
throw; Choose the approach that best suits your error handling and debugging requirements. |
||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The try/catch block has been modified to log the exception using
Debug.LogError
andDebug.LogException
. The code also includes a conditional message for logging exceptions in the Unity Editor or Debug mode. This change improves error visibility in the Unity console.However, there are a few suggestions to consider:
Line 168: The variable
finalMessage
is initialized as an empty string and then assigned a value based on the conditionUNITY_EDITOR || DEBUG
. Instead of initializing it as an empty string, you can directly assign the value inside the condition. This will eliminate the need for an extra line of code.Line 170: The comment mentions "StackTrace log of '{state.Name}' state creation below," but the code actually logs the
CreationStackTrace
instead of the state name. Consider updating the comment to accurately reflect the logged information.Line 172: The error message includes the text "-->> Check the exception log after this one for more details <<--". It's unclear what "exception log" refers to. Consider providing more specific instructions or clarifying the intended behavior.
Line 173: The error message includes the state name, but it's not clear why the state name is relevant in the context of the exception. Consider removing the state name from the error message unless it provides valuable information for debugging.
Line 174: The
Debug.LogException(e)
statement logs the exception object. It's important to note that logging the entire exception object may expose sensitive information in a production environment. Ensure that the exception object does not contain any sensitive data before logging it.