<commit_before><commit_msg>ErrorException<commit_after><?php

namespace Frosas\Misc;

/**
 * Exception representing a PHP error
 */
class ErrorException extends \Exception {
    
    static function createFromLastError() {
        $error = error_get_last();
        if (! $error) throw new \RuntimeException("Hasn't been any error yet");
        return new static($error);
    }
    
    function __construct(array $error) {
        parent::__construct($error['message']);
        $this->file = $error['file'];
        $this->line = $error['line'];
    }
}
{'fraction_non_alphanumeric': 0.14028776978417265, 'fraction_numerical': 0.0, 'mean_word_length': 3.1259259259259258, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, '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': '2868443', 'n_tokens_mistral': 157, 'n_tokens_neox': 156, 'n_words': 37}