func _run_main()

in core/swift53Action/swiftbuild.py.launcher.swift [46:64]


func _run_main(mainFunction: (Any) -> Any, json: Data) -> Void {
    do {
        let parsed = try JSONSerialization.jsonObject(with: json, options: [])
        let result = mainFunction(parsed)
        if JSONSerialization.isValidJSONObject(result) {
            do {
                let jsonData = try JSONSerialization.data(withJSONObject: result, options: [])
                 _whisk_print_result(jsonData: jsonData)
            } catch {
                _whisk_print_error(message: "Failed to encode Dictionary type to JSON string:", error: error)
            }
        } else {
            _whisk_print_error(message: "Error serializing JSON, data does not appear to be valid JSON", error: nil)
        }
    } catch {
        _whisk_print_error(message: "Failed to execute action handler with error:", error: error)
        return
    }
}