     }
 }
 
+enum Error: String, ErrorType, CustomStringConvertible {
+    case FilenameRequired = "Filename Required"
+    var description: String {
+        return self.rawValue
+    }
+}
+
 struct Main {
-    init() {
+    init() throws {
         if Process.arguments.count < 2 {
-            println("Filename required.")
-            assert(false);
+            throw Error.FilenameRequired
         }
 
         let filename = Process.arguments[1]
         let playdown = Playdown(filename: filename)
-        playdown.markdown()
-    }
-}
-
-Main()
+        try playdown.markdown()
+    }
+}
+
+do {
+    let _ = try Main()
+} catch {
+    print(error)
+    exit(1)
+}
        return strippedLine
    }
    
    func stringByAlteringCodeFencing(string: String) -> String {
        let outputText: String
        
        // Add a newline between the markdown delimiter if necessary
        if string.matchesPattern("\\n", options: nil, error: nil) || count(string) == 0 {
            // Empty line
            outputText = "\n" + MarkdownCodeStartDelimiter + string
        } else {

        }
        
        // Read data chunks from file until a line delimiter is found:
        var range = buffer.rangeOfData(delimData, options: [], range: NSMakeRange(0, buffer.length))
        while range.location == NSNotFound {
            let tmpData = fileHandle.readDataOfLength(chunkSize)
            if tmpData.length == 0 {
                // EOF or read error.
                atEof = true
