<commit_before>package buffalo

import (
	"database/sql"
	"encoding/json"
	"encoding/xml"
	"errors"
	"fmt"
	"net/http"
	"runtime/debug"
	"sort"
	"strings"

	"github.com/gobuffalo/buffalo/internal/defaults"
	"github.com/gobuffalo/buffalo/internal/httpx"
	"github.com/gobuffalo/events"
	"github.com/gobuffalo/plush/v4"
)

// HTTPError a typed error returned by http Handlers and used for choosing error handlers
type HTTPError struct {
	Status int   `json:"status"`
	Cause  error `json:"error"`
}

// Unwrap allows the error to be unwrapped.
func (h HTTPError) Unwrap() error {
	return h.Cause
}

// Error returns the cause of the error as string.
func (h HTTPError) Error() string {
	return fmt.Sprint(h.Cause)
}

// ErrorHandler interface for handling an error for a
// specific status code.
type ErrorHandler func(int, error, Context) error
<commit_msg>HTTPError Error() return  when Cause is nil<commit_after>package buffalo

import (
	"database/sql"
	"encoding/json"
	"encoding/xml"
	"errors"
	"fmt"
	"net/http"
	"runtime/debug"
	"sort"
	"strings"

	"github.com/gobuffalo/buffalo/internal/defaults"
	"github.com/gobuffalo/buffalo/internal/httpx"
	"github.com/gobuffalo/events"
	"github.com/gobuffalo/plush/v4"
)

// HTTPError a typed error returned by http Handlers and used for choosing error handlers
type HTTPError struct {
	Status int   `json:"status"`
	Cause  error `json:"error"`
}

// Unwrap allows the error to be unwrapped.
func (h HTTPError) Unwrap() error {
	return h.Cause
}

// Error returns the cause of the error as string.
func (h HTTPError) Error() string {
	if h.Cause != nil {
		return h.Cause.Error()
	}
	return "unknown cause"
}

// ErrorHandler interface for handling an error for a
// specific status code.
type ErrorHandler func(int, error, Context) error

{'fraction_non_alphanumeric': 0.1160964666292765, 'fraction_numerical': 0.0011217049915872126, 'mean_word_length': 4.126436781609195, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4752045', 'n_tokens_mistral': 627, 'n_tokens_neox': 629, 'n_words': 184}