<commit_before>use std::error::{self, Error};
use std::fmt;
use std::any;
use rustc_serialize::json;

pub trait ValicoError: error::Error + fmt::Debug + Send + any::Any + json::ToJson {
    fn get_code(&self) -> &str;
    fn get_path(&self) -> &str;
    fn get_title(&self) -> &str;
    fn get_detail(&self) -> Option<&str> { None }
}

pub type ValicoErrors = Vec<Box<ValicoError>>;

mopafy!(ValicoError);

macro_rules! impl_basic_err {
    ($err:ty, $code:expr) => {<commit_msg>feat(common): impl ToJson for Box<ValicoError><commit_after>use std::error::{self, Error};
use std::fmt;
use std::any;
use rustc_serialize::json;

pub trait ValicoError: error::Error + fmt::Debug + Send + any::Any + json::ToJson {
    fn get_code(&self) -> &str;
    fn get_path(&self) -> &str;
    fn get_title(&self) -> &str;
    fn get_detail(&self) -> Option<&str> { None }
}

impl json::ToJson for Box<ValicoError> {
    fn to_json(&self) -> json::Json {
        (**self).to_json()
    }
}

pub type ValicoErrors = Vec<Box<ValicoError>>;

mopafy!(ValicoError);

macro_rules! impl_basic_err {
    ($err:ty, $code:expr) => {
{'fraction_non_alphanumeric': 0.18354430379746836, 'fraction_numerical': 0.0, 'mean_word_length': 4.507462686567164, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 22, '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': '4359699', 'n_tokens_mistral': 414, 'n_tokens_neox': 413, 'n_words': 90}