summaryrefslogtreecommitdiffstats
path: root/source/core/slang-signal.cpp
diff options
context:
space:
mode:
authorSimon Kallweit <64953474+skallweitNV@users.noreply.github.com>2024-12-06 00:46:56 +0100
committerGitHub <noreply@github.com>2024-12-05 18:46:56 -0500
commitd4136c93448bfdd8561af331ea6eebcec14719e3 (patch)
tree7c12987a4dd4a5f92fdcc74ac800ea869f03fe13 /source/core/slang-signal.cpp
parentce23f078781ae977d827a559e775250dc429709c (diff)
Add API for getting last internal error message (#5772)
* Add API for getting last internal error message * format code (#5773) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> * make message thread_local --------- Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'source/core/slang-signal.cpp')
-rw-r--r--source/core/slang-signal.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/core/slang-signal.cpp b/source/core/slang-signal.cpp
index 4ae75eb0e..8a7690351 100644
--- a/source/core/slang-signal.cpp
+++ b/source/core/slang-signal.cpp
@@ -6,6 +6,8 @@
namespace Slang
{
+thread_local String g_lastSignalMessage;
+
static const char* _getSignalTypeAsText(SignalType type)
{
switch (type)
@@ -54,6 +56,8 @@ String _getMessage(SignalType type, char const* message)
printf("%s\n", _getMessage(type, message).getBuffer());
}
+ g_lastSignalMessage = _getMessage(type, message);
+
#if SLANG_HAS_EXCEPTIONS
switch (type)
{
@@ -75,4 +79,9 @@ String _getMessage(SignalType type, char const* message)
#endif
}
+const char* getLastSignalMessage()
+{
+ return g_lastSignalMessage.getBuffer();
+}
+
} // namespace Slang