 
 public extension BundleUtil {
     
-    public func path(of filename: String?, ofType type: String?) throws -> String {
+    public func path(of filename: String?, ofType type: String?) -> Result<String> {
         guard let path = bundle.path(forResource: filename, ofType: type) else {
-            throw MochaException.fileNotFoundException
+            return .failure(.fileNotFoundException)
         }
-        return path
+        return .success(path)
     }
     
-    public func resourcePath(of filename: String) throws -> String {
+    public func resourcePath(of filename: String) -> Result<String> {
         guard let resourcePath = bundle.resourcePath else {
-            throw MochaException.fileNotFoundException
+            return .failure(.fileNotFoundException)
         }
-        return resourcePath.appendingPathComponent(filename)
+        return .success(resourcePath.appendingPathComponent(filename))
     }
 }
 


public extension BundleUtil {
    
    public func read(_ filename: String?, ofType type: String?, withEncoding encoding: String.Encoding = .utf8) throws -> String {
        let path = try self.path(of: filename, ofType: type)
        return try read(atPath: path)
    }
    
    public func read(atPath filePath: String, withEncoding encoding: String.Encoding = .utf8) throws -> String {
        do {
            return try String(contentsOfFile: filePath, encoding: encoding)
        } catch {
            throw MochaException.genericException(message: "")
        }
    }
}


public extension BundleUtil {
    
    public func file(_ filename: String?, ofType type: String?) -> Result<Data> {
        let path = try self.path(of: filename, ofType: type)
        guard let fileData = try? Data(contentsOf: URL(fileURLWithPath: path)) else {
            return .failure(.fileNotFoundException)
        }
        return .success(fileData)
    }
}

