<commit_before>package errors

import (
	"fmt"
	"net/http"
)

// Error applicational
type Error struct {
	Type    Type
	Message string
	cause   error
}

// Error message
func (e *Error) Error() string {
	return e.Message
}

// Cause of the original error
func (e *Error) Cause() string {
	if e.cause != nil {
		return e.cause.Error()
	}

	return ""
}

// Extensions for graphQL extension
func (e *Error) Extensions() map[string]interface{} {
	return map[string]interface{}{
		"code": e.Type.Code(),
		"type": e.Type,
	}
}<commit_msg>show internal errors in console.<commit_after>package errors

import (
	"fmt"
	"net/http"

	"github.com/rs/zerolog/log"
)

// Error applicational
type Error struct {
	Type    Type
	Message string
	cause   error
}

// Error message
func (e *Error) Error() string {
	return e.Message
}

// Cause of the original error
func (e *Error) Cause() string {
	if e.cause != nil {
		return e.cause.Error()
	}

	return ""
}

// Extensions for graphQL extension
func (e *Error) Extensions() map[string]interface{} {
	if e.cause != nil {
		log.Error().Err(e.cause).Msg("graphql error report")
	}

	return map[string]interface{}{
		"code": e.Type.Code(),
		"type": e.Type,
	}
}
{'fraction_non_alphanumeric': 0.14728033472803348, 'fraction_numerical': 0.0, 'mean_word_length': 3.462686567164179, 'pattern_counts': {'":': 4, '<': 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': '4070716', 'n_tokens_mistral': 443, 'n_tokens_neox': 418, 'n_words': 123}