<commit_before>//===--- Error.swift ------------------------------------------------------===//
//Copyright (c) 2016 <NAME> (dileping)
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//===----------------------------------------------------------------------===//

import Foundation
import Result

#if swift(>=3.0)
#else
    public typealias ErrorProtocol = ErrorType
#endif

public protocol RuntimeErrorType : ErrorProtocol, CustomStringConvertible {
    var customRepresentation:String {get}
}

public extension RuntimeErrorType {
    private func selfThrow() throws {
        throw self
    }
    
    @noreturn
    func panic() {
        try! selfThrow()
        while true {}
    }
    
    var stack:[String] {
        get {
            #if !os(Linux)
                return NSThread.callStackSymbols()
            #else
                return [String]("Runtime error stack trace is not currently supported on Linux")
            #endif
        }
    }
    
    var stackTrace:String {
        get {
            return "Stack trace: \(stack.description)"
        }
    }
    
    func formatDescription(custom:Any) -> String {
        return "\(custom)\n\(stackTrace)"
    }
    
    var customRepresentation:String {
        get {
            return "\(self.dynamicType)"
        }
    }<commit_msg>Error.swift linux fix<commit_after>//===--- Error.swift ------------------------------------------------------===//
//Copyright (c) 2016 <NAME> (dileping)
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//===----------------------------------------------------------------------===//

import Foundation
import Result

#if swift(>=3.0)
#else
    public typealias ErrorProtocol = ErrorType
#endif

public protocol RuntimeErrorType : ErrorProtocol, CustomStringConvertible {
    var customRepresentation:String {get}
}

public extension RuntimeErrorType {
    private func selfThrow() throws {
        throw self
    }
    
    @noreturn
    func panic() {
        try! selfThrow()
        while true {}
    }
    
    var stack:[String] {
        get {
            #if !os(Linux)
                return NSThread.callStackSymbols()
            #else
                return ["Runtime error stack trace is not currently supported on Linux"]
            #endif
        }
    }
    
    var stackTrace:String {
        get {
            return "Stack trace: \(stack.description)"
        }
    }
    
    func formatDescription(custom:Any) -> String {
        return "\(custom)\n\(stackTrace)"
    }
    
    var customRepresentation:String {
        get {
            return "\(self.dynamicType)"
        }
    }
{'fraction_non_alphanumeric': 0.16555740432612312, 'fraction_numerical': 0.005546311702717693, 'mean_word_length': 1.8446372239747635, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7623105', 'n_tokens_mistral': 930, 'n_tokens_neox': 892, 'n_words': 318}