{"record":{"id":"69359f9ab60ed11b","repo":"winstonjs/winston","slug":"deprecated-unhandleexceptions-will-be-removed","errorCode":null,"errorMessage":"Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()","messagePattern":"Deprecated: \\.unhandleExceptions\\(\\) will be removed in winston@4\\. Use \\.exceptions\\.unhandle\\(\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/winston/logger.js","lineNumber":627,"sourceCode":"   * @returns {undefined}\n   * @deprecated\n   */\n  handleExceptions(...args) {\n    // eslint-disable-next-line no-console\n    console.warn(\n      'Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()'\n    );\n    this.exceptions.handle(...args);\n  }\n\n  /**\n   * Backwards compatibility to `exceptions.handle` in winston < 3.0.0.\n   * @returns {undefined}\n   * @deprecated\n   */\n  unhandleExceptions(...args) {\n    // eslint-disable-next-line no-console\n    console.warn(\n      'Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()'\n    );\n    this.exceptions.unhandle(...args);\n  }\n\n  /**\n   * Throw a more meaningful deprecation notice\n   * @throws {Error} - TODO: add throws description.\n   */\n  cli() {\n    throw new Error(\n      [\n        'Logger.cli() was removed in winston@3.0.0',\n        'Use a custom winston.formats.cli() instead.',\n        'See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md'\n      ].join('\\n')\n    );\n  }","sourceCodeStart":609,"sourceCodeEnd":645,"githubUrl":"https://github.com/winstonjs/winston/blob/ff0b79de8562bb322c390fbc82fe71c11f373428/lib/winston/logger.js#L609-L645","documentation":"This is a deprecation warning emitted by winston's Logger.unhandleExceptions(). The method exists only for backwards compatibility with winston < 3.0.0 and simply forwards to logger.exceptions.unhandle(). It will be removed entirely in winston@4, so code relying on it will break on upgrade.","triggerScenarios":"Calling logger.unhandleExceptions(...args) (typically with the same handler function previously passed to unhandleExceptions() or handleExceptions()) to stop catching uncaught exceptions instead of calling logger.exceptions.unhandle(...).","commonSituations":"Upgrading a winston 2.x codebase to winston 3.x and keeping the old API call; copying legacy logging setup snippets from older tutorials or internal boilerplate.","solutions":["Replace logger.unhandleExceptions(handler) with logger.exceptions.unhandle(handler).","Alternatively use logger.unhandleExceptions(false) semantics equivalent: logger.exceptions.unhandle(false) to unhandle without exiting.","Audit the codebase for .unhandleExceptions( occurrences and remove all before migrating to winston@4."],"exampleFix":"// before\nlogger.unhandleExceptions(myExceptionHandler);\n// after\nlogger.exceptions.unhandle(myExceptionHandler);","handlingStrategy":"validation","validationCode":"// Fail fast in dev/test if deprecated winston APIs are used\nif (typeof logger.unhandleExceptions === 'function' && logger.unhandleExceptions !== logger.exceptions.unhandle) {\n  // prefer the modern API\n  const unhandle = logger.exceptions.unhandle.bind(logger.exceptions);\n}","typeGuard":"function usesLegacyUnhandle(logger) {\n  return typeof logger.unhandleExceptions === 'function';\n}","tryCatchPattern":null,"preventionTips":["Always use the exceptions/rejections controller API (logger.exceptions.unhandle) in winston >= 3.","Run tests with NODE_OPTIONS=--pending-deprecation --trace-warnings to surface winston deprecations in CI.","Grep for legacy winston method names when upgrading major versions."],"tags":["deprecation","winston","logging","uncaught-exception"],"backgroundTag":"deprecated-api-usage","analyzedSha":"ff0b79de8562bb322c390fbc82fe71c11f373428","analyzedAt":"2026-08-31T13:33:44.585Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}