 
 let serd_end_sink : @convention(c) (UnsafeMutableRawPointer?, UnsafePointer<SerdNode>?) -> SerdStatus = { (handle, node) -> SerdStatus in return SERD_SUCCESS }
 
-let serd_error_sink : @convention(c) (UnsafeMutableRawPointer?, UnsafePointer<SerdError>?) -> SerdStatus = { (reader, error) in
+let serd_error_sink : @convention(c) (UnsafeMutableRawPointer?, UnsafePointer<SerdError>?) -> SerdStatus = { (handle, error) in
     if let error = error {
         let e = error.pointee
         let filename = String(cString: e.filename)
         let fmt = String(cString: e.fmt)
-        Logger.shared.error("serd error while parsing \(filename): \(fmt))")
+        let msg = "serd error while parsing \(filename): \(fmt))"
+        Logger.shared.error(msg)
+        if let ptr = handle?.assumingMemoryBound(to: ParserContext.self) {
+            let ctx = ptr.pointee
+            ctx.errors.append(RDFParser.RDFParserError.parseError(msg))
+        }
     } else {
         Logger.shared.error("serd error during parsing")
     }

        serd_env_free(env)
        serd_node_free(&base)
        
        if status != SERD_SUCCESS {
            throw RDFParserError.parseError("Failed to parse file using serd")
        }

        return context.count
    }
}

        self.count = 0
        self.env = env
        self.handler = handler
        self.errors = []
    }
}

