     
     // MARK: - Public Methods
     static func generateFrame(text: String) -> StompFrame {
-        let type = StompResponseType(rawValue: String(text.characters.first!))!
+        let type = StompResponseType(rawValue: String(text.characters.first!))
         do {
             let (command, headers, body) = try String(text.characters.dropFirst()).parseJSONText()
             return StompFrame(type: type, command: command, headers: headers, body: body)

    }
    
    var message: String {
        let filteredHeaders = headers.filter { header -> Bool in
            return header.isMessage
        }
        
        if filteredHeaders.isEmpty {
            return ""
        } else {
            return filteredHeaders.first!.value
        }
    }
    
    var destination: String {
        let filteredHeaders = headers.filter { header -> Bool in
            return header.isDestination
        }
        
        if filteredHeaders.isEmpty {
            return ""
        } else {
            return filteredHeaders.first!.value
        }
    }
    
    // MARK: - Private Properties
    private let lineFeed = "\u{0A}"
    private let nullChar = "\u{00}"
    private(set) var type: StompResponseType?
    private(set) var command: StompCommand
    private(set) var headers: Set<StompHeader>

        return key.hashValue
    }
    
    // MARK: - Initializers
    init(key: String, value: String) throws {
        switch key {
        case "version":
            self = .Version(version: value)
        case "subscription":
            self = .Subscription(subId: value)
        case "message-id":
            self = .MessageId(id: value)
        case "content-length":
            self = .ContentLength(length: value)
        case "message":
            self = .Message(message: value)
        case "destination":
            self = .Destination(path: value)
        case "heart-beat":
            self = .HeartBeat(value: value)
        default:
            throw NSError(domain: "com.shenghuawu.error", code: 999, userInfo: [NSLocalizedDescriptionKey : "Received header key-value pair is undefined."])
        }
    }
    
