<commit_before>
# pull in external modules
_ ?= require '../third_party/underscore-min.js'
runtime ?= require './runtime'
util ?= require './util'
{log,debug,error} = util

# things assigned to root will be available outside this module
root = exports ? this.jvm = {}

run = (rs, fn, done_cb) ->
  try
    fn()
    done_cb?()
    return true
  catch e
    if e instanceof util.JavaException
      debug "\nUncaught #{e.exception.type.toClassString()}: #{rs.jvm2js_str e.exception.fields.detailMessage}"
      rs.show_state()
      rs.push rs.curr_thread, e.exception
      rs.method_lookup(
        class: 'java/lang/Thread'
        sig: 'dispatchUncaughtException(Ljava/lang/Throwable;)V').run(rs)
    else if e instanceof util.HaltException
      console.error "\nExited with code #{e.exit_code}" unless e.exit_code is 0
    else if e instanceof util.YieldIOException or e instanceof util.YieldException
      retval = null
      e.condition ->
        rs.meta_stack().resuming_stack = 0  # <-- index into the meta_stack of the frame we're resuming
        retval = run rs, fn, done_cb
      return retval
    else
      error "\nInternal JVM Error: #{e?.stack}"
      rs.show_state()
    unless e instanceof util.YieldIOException or e instanceof util.YieldException<commit_msg>fixing log level for java exceptions<commit_after>
# pull in external modules
_ ?= require '../third_party/underscore-min.js'
runtime ?= require './runtime'
util ?= require './util'
{log,debug,error} = util

# things assigned to root will be available outside this module
root = exports ? this.jvm = {}

run = (rs, fn, done_cb) ->
  try
    fn()
    done_cb?()
    return true
  catch e
    if e instanceof util.JavaException
      error "\nUncaught #{e.exception.type.toClassString()}: #{rs.jvm2js_str e.exception.fields.detailMessage}"
      rs.show_state()
      rs.push rs.curr_thread, e.exception
      rs.method_lookup(
        class: 'java/lang/Thread'
        sig: 'dispatchUncaughtException(Ljava/lang/Throwable;)V').run(rs)
    else if e instanceof util.HaltException
      console.error "\nExited with code #{e.exit_code}" unless e.exit_code is 0
    else if e instanceof util.YieldIOException or e instanceof util.YieldException
      retval = null
      e.condition ->
        rs.meta_stack().resuming_stack = 0  # <-- index into the meta_stack of the frame we're resuming
        retval = run rs, fn, done_cb
      return retval
    else
      error "\nInternal JVM Error: #{e?.stack}"
      rs.show_state()
    unless e instanceof util.YieldIOException or e instanceof util.YieldException
{'fraction_non_alphanumeric': 0.10762679055361982, 'fraction_numerical': 0.0023228803716608595, 'mean_word_length': 3.0757097791798107, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6090513', 'n_tokens_mistral': 793, 'n_tokens_neox': 786, 'n_words': 236}