<commit_before>package config

const (
	ERR_INDEX_FULL              = 2001
	ERR_INDEX_KEY_NOT_FOUND     = 2002
	ERR_INDEX_INACTIVE          = 2003
	ERR_CONFIG_SET_EXISTING_KEY = 1004
)

type JSONable interface {
	JSONableError() interface{}
}

type Error struct {
	ErrNo   int    // Error Number
	ErrInfo string // Additional error info
}

func (e Error) Error() string {
	return "Error: " + e.ErrorString()
}

func (e Error) ErrorString() string {
	errString := "Unknown Error"
	switch e.ErrNo {
	case ERR_INDEX_FULL:
		errString = "index block has reached max capacity"
	case ERR_INDEX_KEY_NOT_FOUND:
		errString = "index key not found"
	case ERR_CONFIG_SET_EXISTING_KEY:
		errString = "key already exists. Use overwrite() to overwrite it"
	case ERR_INDEX_INACTIVE:
		errString = "key is either inactive or deleted"
	}
	return errString + ". " + e.ErrInfo
}

func (e Error) JSONableError() interface{} {
	return struct {
		Error   string
		ErrorNo int
	}{
		e.ErrorString(),
		e.ErrNo,
	}
}<commit_msg>[Config] remove more 'jsonable' nonsense<commit_after>package config

const (
	ERR_INDEX_FULL              = 2001
	ERR_INDEX_KEY_NOT_FOUND     = 2002
	ERR_INDEX_INACTIVE          = 2003
	ERR_CONFIG_SET_EXISTING_KEY = 1004
)

type Error struct {
	ErrNo   int    // Error Number
	ErrInfo string // Additional error info
}

func (e Error) Error() string {
	return "Error: " + e.ErrorString()
}

func (e Error) ErrorString() string {
	errString := "Unknown Error"
	switch e.ErrNo {
	case ERR_INDEX_FULL:
		errString = "index block has reached max capacity"
	case ERR_INDEX_KEY_NOT_FOUND:
		errString = "index key not found"
	case ERR_CONFIG_SET_EXISTING_KEY:
		errString = "key already exists. Use overwrite() to overwrite it"
	case ERR_INDEX_INACTIVE:
		errString = "key is either inactive or deleted"
	}
	return errString + ". " + e.ErrInfo
}
{'fraction_non_alphanumeric': 0.08676789587852494, 'fraction_numerical': 0.01735357917570499, 'mean_word_length': 3.682741116751269, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1950204', 'n_tokens_mistral': 666, 'n_tokens_neox': 619, 'n_words': 182}