diff --git a/scripts/handleErrors.ts b/scripts/handleErrors.ts index cf2ce377aa..a8302491ce 100644 --- a/scripts/handleErrors.ts +++ b/scripts/handleErrors.ts @@ -96,7 +96,7 @@ class HandleErrors extends Script { " is identical to previously seen changeset, not writing to file" )*/ } else { - const changesetWithMsg = ` + const changesetWithMsg = ` ${changeset}` writeFileSync(path, changesetWithMsg, "utf8") createdChangesets.add(changeset) @@ -115,14 +115,13 @@ ${changeset}` console.log("Written refused", path) } } + private readonly osmConnection = new OsmConnection() + private readonly downloader = new OsmObjectDownloader(this.osmConnection.Backend(), undefined) - async main(args: string[]): Promise { - const osmConnection = new OsmConnection() - const downloader = new OsmObjectDownloader(osmConnection.Backend(), undefined) - - const path = args[0] + async fixForFile(path: string){ const lines = readFileSync(path, "utf8").split("\n") - + const osmConnection = this.osmConnection + const downloader = this.downloader const createdChangesets = new Set() const refusedFiles: Set = new Set() refusedFiles.add("[]") @@ -143,7 +142,7 @@ ${changeset}` try { const parsed: ErrorMessage = JSON.parse(line) const e = parsed.message - if (e.layout === "grb") { + if (e.theme === "grb") { console.log("Skipping GRB ") continue } @@ -182,6 +181,18 @@ ${changeset}` } } } + + async main(args: string[]): Promise { + if(args[0] === undefined){ + console.log("Please specify the error file to handle") + return + } + + for (const path of args) { + await this.fixForFile(path) + } + + } } new HandleErrors().run()