{"id":25961694,"url":"https://github.com/ttab/flerr","last_synced_at":"2025-07-27T18:14:52.702Z","repository":{"id":272946054,"uuid":"918252057","full_name":"ttab/flerr","owner":"ttab","description":"flerr makes it easy to capture errors from deferred functions and allows something close to a block level defer","archived":false,"fork":false,"pushed_at":"2025-01-19T11:29:52.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-04T19:44:01.311Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ttab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-17T14:56:27.000Z","updated_at":"2025-01-19T11:29:53.000Z","dependencies_parsed_at":"2025-01-17T16:40:46.375Z","dependency_job_id":"3f4255b0-5332-4b95-9e94-e2c273f3e0ff","html_url":"https://github.com/ttab/flerr","commit_stats":null,"previous_names":["ttab/flerr"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ttab/flerr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fflerr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fflerr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fflerr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fflerr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttab","download_url":"https://codeload.github.com/ttab/flerr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fflerr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267400739,"owners_count":24081191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-04T19:41:00.540Z","updated_at":"2025-07-27T18:14:52.682Z","avatar_url":"https://github.com/ttab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flush errors\n\nHelper library that can be used to capture errors from deferred functions and allows something close to a block level defer.\n\nExample usage:\n\n``` go\nfunc createScriptDir(sourceDir embed.FS, scriptDir string) (outErr error) {\n\terr := os.MkdirAll(scriptDir, 0o700)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create script directory: %w\", err)\n\t}\n\n\tscripts, err := sourceDir.ReadDir(\".\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"list files in source directory: %w\", err)\n\t}\n\n\tvar clean flerr.Cleaner\n\n\t// Clean up all files when the function returns, joining in any errors\n\t// that might result from the cleanup.\n\tdefer clean.FlushTo(\u0026outErr)\n\n\tfor _, f := range scripts {\n\t\tif f.IsDir() || !strings.HasSuffix(f.Name(), \".py\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tsrc, err := pysrc.Scripts.Open(f.Name())\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"open %q for reading: %w\", f.Name(), err)\n\t\t}\n\n\t\tclean.Addf(src.Close, \"close %q\", f.Name())\n\n\t\tdst, err := os.Create(filepath.Join(scriptDir, f.Name()))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"create destination file for %q: %w\", f.Name(), err)\n\t\t}\n\n\t\tclean.Addf(dst.Close, \"close %q destination\", f.Name())\n\n\t\t_, err = io.Copy(dst, src)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"copy %q: %w\", f.Name(), err)\n\t\t}\n\n\t\t// Clean up all files at the end of the loop.\n\t\terr = clean.Flush()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttab%2Fflerr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttab%2Fflerr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttab%2Fflerr/lists"}