<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Throw() with traceback flag within a sub-function crashes JMP in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Throw-with-traceback-flag-within-a-sub-function-crashes-JMP/m-p/910856#M107013</link>
    <description>&lt;P&gt;you've found a bug in JMP, I'm submitting a report pointing to this thread. You can work around it by commenting out the local variable for sub_f:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;f = Function( {}, // { sub_f },&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(Pretty sure this is a reasonably correct explanation...) By the time JMP catches the throw() the local variables are destroyed and the information for the traceback has been lost. The code that produces the traceback is unprepared for that and crashes with an invalid memory reference. When you added the try() inside the function, JMP catches the throw inside the function and the local has not been destroyed. Or, just keep the function in a global will also work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;edit:&amp;nbsp;TS-00250890&lt;/P&gt;</description>
    <pubDate>Sat, 01 Nov 2025 11:21:37 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2025-11-01T11:21:37Z</dc:date>
    <item>
      <title>Throw() with traceback flag within a sub-function crashes JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Throw-with-traceback-flag-within-a-sub-function-crashes-JMP/m-p/910843#M107011</link>
      <description>&lt;P&gt;I 've encountered the following issue (minimal example below). Is this a bug or am I missing something?&lt;/P&gt;
&lt;P&gt;(Windows 11, JMP 18.0)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;The following script crashes JMP instead of simply throwing the error:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

f = Function( {}, { sub_f },

	sub_f = Function( {},
		If( 1, Throw( "thrown", 1 ) );			
		Return( "ok" )
	);
	
	Return( sub_f() )
);

f()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In contrast to the above, without the traceback flag, it normally throws the "thrown" error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

f = Function( {}, { sub_f },

	sub_f = Function( {},
		If( 1, Throw( "thrown" ) );			
		Return( "ok" )
	);
	
	Return( sub_f() )
);

f()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also, the crash is prevented by trapping the Return()&amp;nbsp; into Try().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

f = Function( {}, { sub_f },

	sub_f = Function( {},
		If( 1, Throw( "thrown", 1 ) );			
		Return( "ok" )
	);
	
	Try( Return( sub_f() ), Throw( "crash prevented" ) )
);

f()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 20:12:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Throw-with-traceback-flag-within-a-sub-function-crashes-JMP/m-p/910843#M107011</guid>
      <dc:creator>AlterEgo</dc:creator>
      <dc:date>2025-10-31T20:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Throw() with traceback flag within a sub-function crashes JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Throw-with-traceback-flag-within-a-sub-function-crashes-JMP/m-p/910856#M107013</link>
      <description>&lt;P&gt;you've found a bug in JMP, I'm submitting a report pointing to this thread. You can work around it by commenting out the local variable for sub_f:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;f = Function( {}, // { sub_f },&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(Pretty sure this is a reasonably correct explanation...) By the time JMP catches the throw() the local variables are destroyed and the information for the traceback has been lost. The code that produces the traceback is unprepared for that and crashes with an invalid memory reference. When you added the try() inside the function, JMP catches the throw inside the function and the local has not been destroyed. Or, just keep the function in a global will also work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;edit:&amp;nbsp;TS-00250890&lt;/P&gt;</description>
      <pubDate>Sat, 01 Nov 2025 11:21:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Throw-with-traceback-flag-within-a-sub-function-crashes-JMP/m-p/910856#M107013</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2025-11-01T11:21:37Z</dc:date>
    </item>
  </channel>
</rss>

