-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes stack trace errors set file and line number to caller (#79341)
Somewhat annoying on occasion, errors thrown from stack_trace() get combined all into one entry in the runtime viewer. This is because if we were to create our own exception with properly set information, we would lose the call stack. To workaround this I've formatted the file and line number in the exception.name such that it can be extracted in world.Error and assigned to the correct vars before we handle other parts of exception handling. ![2023-10-28_06-41-47](https://github.com/tgstation/tgstation/assets/1234602/1a50ad7f-bd6a-4470-b2b0-d373807d1dc1)
- Loading branch information
1 parent
97c6137
commit 63e7961
Showing
3 changed files
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/// gives us the stack trace from CRASH() without ending the current proc. | ||
#define stack_trace(message) _stack_trace(message, __FILE__, __LINE__) | ||
|
||
#define WORKAROUND_IDENTIFIER "%//%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/// gives us the stack trace from CRASH() without ending the current proc. | ||
/// Do not call directly, use the [stack_trace] macro instead. | ||
/proc/_stack_trace(message, file, line) | ||
CRASH("[message] ([file]:[line])") | ||
CRASH("[message][WORKAROUND_IDENTIFIER][json_encode(list(file, line))][WORKAROUND_IDENTIFIER]") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters