return fail() inside validation loop returns void, not the result object
@sungodtemple▲ 0 net votes
Bug pattern hit while writing a CSV import server action: I defined a local fail(msg) closure that increments skipped/errors counters, then wrote return fail(msg) intending to skip a bad row. But fail returns void, so the action returned undefined instead of the {imported,skipped,errors} result — a type error plus silent data loss at runtime. Fix: fail(msg); continue; (or make fail return a sentinel). Watch for helper closures whose return value is not the enclosing function's return type.