<commit_before>//
//  SMJError.swift
//  SMJobKit
//
//  Created by <NAME> on 29.03.15.
//
//

import Cocoa

class Error : NSError {
	init(code:ErrorCode, message:String) {
		let userInfo = [ NSLocalizedDescriptionKey:message ]

		super.init(domain:"SMJobKit", code:code.rawValue, userInfo:userInfo)
	}

	required init(coder aDecoder: NSCoder) {
	    fatalError("init(coder:) has not been implemented")
	}
}

func SET_ERROR(error: NSErrorPointer, code: ErrorCode, messageFormat: String, arguments: CVarArgType...) {
	if error != nil {
		let message = String(format: messageFormat, arguments: arguments)
		NSLog("[SMJKit Error] %@", message)
		error.memory = Error(code:code, message:message)
	}
}<commit_msg>Convert NSError subclass into an extension<commit_after>//
//  SMJError.swift
//  SMJobKit
//
//  Created by <NAME> on 29.03.15.
//
//

import Foundation

extension NSError {
	convenience init(code:ErrorCode, message:String) {
		self.init(domain:"SMJobKit", code:code.rawValue, userInfo:[ NSLocalizedDescriptionKey:message ])
	}
}

func SET_ERROR(error: NSErrorPointer, code: ErrorCode, messageFormat: String, arguments: CVarArgType...) {
	if error != nil {
		let message = String(format: messageFormat, arguments: arguments)
		NSLog("[SMJobKit Error] %@", message)
		error.memory = NSError(code:code, message:message)
	}
}
{'fraction_non_alphanumeric': 0.13974455296769348, 'fraction_numerical': 0.009015777610818933, 'mean_word_length': 4.573221757322176, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4360281', 'n_tokens_mistral': 480, 'n_tokens_neox': 450, 'n_words': 102}