mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add guards to prevent activation errors slipping through (#5845)
* Add guards to prevent activation errors slipping through Signed-off-by: Sebastian Malton <sebastian@malton.name> * Make sure all logging has a message, output less errors when prometheus fails Signed-off-by: Sebastian Malton <sebastian@malton.name> * Improve logging from getPortFromStream Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
0d2aea0101
commit
81c18a6cad
8 files changed
+43
-17
No files matched your search
@@ -20,6 +20,7 @@ interface GetPortArgs {
|
||||
};
|
||||
raw?: RegExpExecArray;
|
||||
};
|
||||
rawMatcher: string;
|
||||
};
|
||||
/**
|
||||
* Called when the port is found
|
||||
@@ -27,7 +28,7 @@ interface GetPortArgs {
|
||||
onFind?: () => void;
|
||||
/**
|
||||
* Timeout for how long to wait for the port.
|
||||
* Default: 5s
|
||||
* Default: 15s
|
||||
*/
|
||||
timeout?: number;
|
||||
}
|
||||
@@ -61,7 +62,7 @@ export function getPortFrom(stream: Readable, args: GetPortArgs): Promise<number
|
||||
};
|
||||
const timeoutID = setTimeout(() => {
|
||||
stream.off("data", handler);
|
||||
logger.warn(`[getPortFrom]: failed to retrieve port via ${args.lineRegex.toString()}: ${logLines}`);
|
||||
logger.warn(`[getPortFrom]: failed to retrieve port via ${args.lineRegex.rawMatcher}`, logLines);
|
||||
reject(new Error("failed to retrieve port from stream"));
|
||||
}, args.timeout ?? 15000);
|
||||
|
||||
|
||||
Reference in new issue
Block a user