<commit_before>package json.parser

import json.Skimbo
import play.api.libs.json._
import play.api.Logger

trait GenericParser {
  def cut(json: String): List[JsValue] = cut(Json.parse(json))
  def cut(json: JsValue): List[JsValue] = json.as[List[JsValue]]
  protected def asSkimbo(json:JsValue): Option[Skimbo]
  def nextSinceId(sinceId:String, sinceId2:String): String = sinceId 
  
  def asSkimboSafe(json: JsValue) : Option[Skimbo] = {
    try {
      asSkimbo(json)
    } catch {
      case _ : Throwable => {
        Logger.error("Error during parsing this message")
        Logger.error(json.toString)
        None
      }
    }
  }
}<commit_msg>Better logging for parsing failures<commit_after>package json.parser

import json.Skimbo
import play.api.libs.json._
import play.api.Logger

trait GenericParser {
  def cut(json: String): List[JsValue] = cut(Json.parse(json))
  def cut(json: JsValue): List[JsValue] = json.as[List[JsValue]]
  protected def asSkimbo(json:JsValue): Option[Skimbo]
  def nextSinceId(sinceId:String, sinceId2:String): String = sinceId 
  
  def asSkimboSafe(json: JsValue) : Option[Skimbo] = {
    try {
      asSkimbo(json)
    } catch {
      case ex : Throwable => {
        Logger.error("Error during parsing this message", ex)
        Logger.error(json.toString)
        None
      }
    }
  }
}
{'fraction_non_alphanumeric': 0.11927981995498875, 'fraction_numerical': 0.0015003750937734434, 'mean_word_length': 3.4466666666666668, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4804978', 'n_tokens_mistral': 461, 'n_tokens_neox': 453, 'n_words': 96}