<?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: Is there a way to capture logs without silencing exceptions? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679812#M86591</link>
    <description>&lt;P&gt;Thanks Craige, this is perfect!&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2023 19:54:10 GMT</pubDate>
    <dc:creator>mat-ski</dc:creator>
    <dc:date>2023-09-20T19:54:10Z</dc:date>
    <item>
      <title>Is there a way to capture logs without silencing exceptions?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679438#M86555</link>
      <description>&lt;P&gt;In my test framework I would like to cut out the clutter that results from Prints/Writes/handled exceptions from my output file, so I tried executing test code inside of a Log Capture( Eval( testExpression ) ). My problem is that this seems to also silence any exceptions that get thrown when evaluating the testExpression, which I did not expect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Try(
	logs = Log Capture( 
		Throw( "newsflash buddy!" );
	);&lt;BR /&gt;    Print( "Logs: " || logs );
,
	Print( "Error:" || exception_msg )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I would like to get the logs, but still end up in the catch in case the code inside of the Capture throws.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Side-question: my thrown exception doesn't actually appear in the logs, which further confuses me as to why the capture silences it.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 18:24:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679438#M86555</guid>
      <dc:creator>mat-ski</dc:creator>
      <dc:date>2023-09-19T18:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to capture logs without silencing exceptions?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679533#M86561</link>
      <description>&lt;P&gt;See if this function works for your purpose.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="log.PNG" style="width: 958px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/56774i3D5E5AB7D2874E36/image-size/large?v=v2&amp;amp;px=999" role="button" title="log.PNG" alt="log.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 20:43:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679533#M86561</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-09-19T20:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to capture logs without silencing exceptions?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679540#M86562</link>
      <description>&lt;P&gt;Hi Mark, the function that you've linked is the one to which I was referring in my original post. The issue that I am having is that exceptions thrown in the expressions inside the capture are suppressed. For instance, in my snippet above, the Print in the catch block does not get executed.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 20:54:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679540#M86562</guid>
      <dc:creator>mat-ski</dc:creator>
      <dc:date>2023-09-19T20:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to capture logs without silencing exceptions?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679546#M86564</link>
      <description>&lt;P&gt;I don't remember the details, but it was necessary for LogCapture to handle any unresolved throws. It can't rethrow and save the result into &lt;EM&gt;logs&lt;/EM&gt; without your help--something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Try(
	logs = Log Capture(
		Try(
			rememberException = Empty();
			Print( "Hello" );
			Throw( "newsflash buddy!" );
		,
			rememberException = exception_msg
		)
	);
	Print( "Logs: " || logs );
	If( !Is Empty( rememberException ),
		throw( "remember: " || rememberException )
	);
,
	Print( "Error: " || exception_msg )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;"Logs: &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;\!"Hello\!""&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"Error: remember: newsflash buddy!"&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 22:52:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679546#M86564</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-09-19T22:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to capture logs without silencing exceptions?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679624#M86570</link>
      <description>&lt;P&gt;I forgot to mention that you can save the result returned by this function for examination.&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;' reply shows how you might use this function instead of printing from within any code provided as an argument. I'm sorry for the confusion.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 12:05:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679624#M86570</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2023-09-20T12:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to capture logs without silencing exceptions?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679812#M86591</link>
      <description>&lt;P&gt;Thanks Craige, this is perfect!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 19:54:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-a-way-to-capture-logs-without-silencing-exceptions/m-p/679812#M86591</guid>
      <dc:creator>mat-ski</dc:creator>
      <dc:date>2023-09-20T19:54:10Z</dc:date>
    </item>
  </channel>
</rss>

