@@ -158,41 +158,16 @@ function yyUnhandledExceptionHandler( event )
158
158
game_end ( - 1 ) ;
159
159
} // end if
160
160
else {
161
- // Create a regular expression pattern to split error stack string.
162
- const regexPattern = new RegExp ( "\n\\s*?at" ) ;
163
-
164
161
let error = event . error ;
165
- const message = error . message ;
166
-
167
- // Split the error stack string into an array of call stack entries and remove leading/trailing spaces.
168
- // The first entry, usually a message or irrelevant info, is omitted.
169
- const stacktrace = error . stack
170
- . split ( regexPattern )
171
- . map ( entry => entry . trim ( ) )
172
- . slice ( 1 ) ;
173
-
174
- // Attempt to parse the first call stack entry to identify the script where the error originated.
175
- // The script name is assumed to be the substring before the first space in the entry.
176
- let script = "" ;
177
- if ( stacktrace . length > 0 ) {
178
- const firstEntry = stacktrace [ 0 ] ;
179
- const firstSpaceIndex = firstEntry . indexOf ( ' ' ) ;
180
- if ( firstSpaceIndex !== - 1 ) {
181
- script = firstEntry . substring ( 0 , firstSpaceIndex ) ;
182
- } else {
183
- script = firstEntry ;
184
- }
185
- }
186
162
187
163
// Construct a GML struct to encapsulate the error details.
188
164
let errorStruct = { }
189
165
errorStruct . __type = "___struct___" ;
190
166
errorStruct . __yyIsGMLObject = true ;
191
167
192
168
// Add error details to the struct with a "gml" prefix for each member.
193
- errorStruct . gmlmessage = message ;
194
- errorStruct . gmlstacktrace = stacktrace ;
195
- errorStruct . gmlscript = script ;
169
+ errorStruct . gmlmessage = error . message ;
170
+ errorStruct . gmlstacktrace = error . stack ;
196
171
197
172
// Pass the error struct to the custom error handler
198
173
var ret = g_GMLUnhandledExceptionHandler ( undefined , undefined , errorStruct ) ;
0 commit comments