Merge pull request #302835 from microsoft/copilot/narrow-eagle

Enhance ListenerLeakError and ListenerRefusalError to include detailed debugging information
This commit is contained in:
Johannes Rieken
2026-03-18 15:41:56 +01:00
committed by GitHub

View File

@@ -1071,9 +1071,16 @@ class Stacktrace {
// error that is logged when going over the configured listener threshold
export class ListenerLeakError extends Error {
constructor(message: string, stack: string) {
super(message);
/**
* The detailed message including listener count and most frequent stack.
* Available locally for debugging but intentionally not used as the error
* `message` so that all leak errors group under the same title in telemetry.
*/
readonly details: string;
constructor(details: string, stack: string) {
super('potential listener LEAK detected');
this.name = 'ListenerLeakError';
this.details = details;
this.stack = stack;
}
}
@@ -1081,9 +1088,16 @@ export class ListenerLeakError extends Error {
// SEVERE error that is logged when having gone way over the configured listener
// threshold so that the emitter refuses to accept more listeners
export class ListenerRefusalError extends Error {
constructor(message: string, stack: string) {
super(message);
/**
* The detailed message including listener count and most frequent stack.
* Available locally for debugging but intentionally not used as the error
* `message` so that all refusal errors group under the same title in telemetry.
*/
readonly details: string;
constructor(details: string, stack: string) {
super('potential listener LEAK detected (REFUSED to add)');
this.name = 'ListenerRefusalError';
this.details = details;
this.stack = stack;
}
}