function hilightUserCode(line) {
  // ignore first line (error message) or already enhanced
  if (!line.includes(" at ") || line.startsWith(MARKER)) {
    return line;
  }

  const isKuzzleCode = line.includes("kuzzle/lib/");
  const isNodeCode =
    !line.includes("at /") &&
    !line.includes("at async /") &&
    line.charAt(line.indexOf("(") + 1) !== "/";
  const isModuleCode = line.includes("node_modules");
  if (isKuzzleCode || isNodeCode || isModuleCode) {
    return PADDING + line;
  }

  // hilight user code
  return MARKER + line;
}
Hilight user code

e.g.
      at BackendController._add (/home/kuzzle/lib/core/application/backend.ts:261:28)
      at BackendController.register (/home/kuzzle/lib/core/application/backend.ts:187:10)
>>>>  at registerFoo (/home/aschen/projets/app/test.ts:12:18)
>>>>  at init (/home/aschen/projets/app/test.ts:8:3)
      at Module._compile (internal/modules/cjs/loader.js:1133:30)