<commit_before><?php
/**
 * Exceptions that can be rendered to the user in a
 * safe way
 */
namespace Minds\Exceptions;

use Minds\Entities\ValidationErrorCollection;
use Minds\Traits\MagicAttributes;

/**
 * @method ValidationErrorCollection getErrors()
 * @method self setErrors(ValidationErrorCollection $errors)
 */
class UserErrorException extends \Exception
{
    use MagicAttributes;

    public function __construct($message = "", $code = 0, ?ValidationErrorCollection $errors = null)
    {
        parent::__construct($message, $code);
        $this->setErrors($errors);
    }

    /** @var string */
    protected $message = "An unknown error occurred";
}<commit_msg>(fix): Fixed issue with exception message being overwritten:<commit_after><?php
/**
 * Exceptions that can be rendered to the user in a
 * safe way
 */
namespace Minds\Exceptions;

use Minds\Entities\ValidationErrorCollection;

class UserErrorException extends \Exception
{
    private ?ValidationErrorCollection $errors;

    /** @var string */
    protected $message = "An unknown error occurred";

    public function __construct($message = "", $code = 0, ?ValidationErrorCollection $errors = null)
    {
        parent::__construct(
            !empty($message) ? $message : $this->message,
            $code
        );
        $this->setErrors($errors);
    }

    /**
     * Set the validation errors collection to be returned with the exception
     * @param ValidationErrorCollection|null $errors
     * @return $this
     */
    public function setErrors(?ValidationErrorCollection $errors): self
    {
        $this->errors = $errors;
        return $this;
    }

    /**
     * Returns the collection of validation errors
     * @return ValidationErrorCollection|null
     */
    public function getErrors(): ?ValidationErrorCollection
    {
        return $this->errors;
    }
}
{'fraction_non_alphanumeric': 0.10867237687366167, 'fraction_numerical': 0.0010706638115631692, 'mean_word_length': 3.2094594594594597, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '5695294', 'n_tokens_mistral': 491, 'n_tokens_neox': 479, 'n_words': 143}