// Hook: AfterPacketGeneration (or any hook) // A demo script that occasionally surfaces a comical error. // // Triggers AddError on roughly 10% of runs so demos and dashboards have // something interesting to show. Also writes an audit row each time, using // the per-job state helpers (GetValue/SetValue) to keep a running counter. using System.IO; var comicalErrors = new[] { "Cell A1 quit and took the formulas with it.", "Packet generation refused - it's a Friday after 4pm.", "Excel has achieved consciousness. Please remain calm.", "Too many pivot tables detected. They are now pivoting against us.", "The spreadsheet has filed a complaint with HR about your formatting choices.", "Clippy is back. He looks angry.", "VLOOKUP could not find what it was looking for. It never could.", "Macros are on a coffee break. Expected back never.", "Detected unauthorized fun in column B. Please remove." }; var rng = new Random(); if (rng.NextDouble() < 0.1) { var message = comicalErrors[rng.Next(comicalErrors.Length)]; Logger.LogInformation($"Demo error injected for '{OutputName}': {message}"); AddError($"Error during '{HookName}' - {message}"); } else { Logger.LogInformation($"Packet '{OutputName}' generated without incident."); }