mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-13 15:46:22 +00:00
fix: stop sending port-in-use errors to Sentry (#558)
Port conflicts are expected — Chromium retries with a different port. These errors were flooding Sentry (14k+ events) without user impact. - handleStartupError: move Sentry.captureException below the port-in-use check so it only fires for unexpected startup errors - handleControllerStartupError: skip Sentry capture for port errors - index.ts: exit early for port errors before Sentry capture
This commit is contained in:
@@ -20,6 +20,7 @@ import './lib/polyfill'
|
||||
import { EXIT_CODES } from '@browseros/shared/constants/exit-codes'
|
||||
import { CommanderError } from 'commander'
|
||||
import { loadServerConfig } from './config'
|
||||
import { isPortInUseError } from './lib/port-binding'
|
||||
import { Sentry } from './lib/sentry'
|
||||
import { Application } from './main'
|
||||
|
||||
@@ -39,6 +40,9 @@ try {
|
||||
if (error instanceof CommanderError) {
|
||||
process.exit(error.exitCode)
|
||||
}
|
||||
if (isPortInUseError(error)) {
|
||||
process.exit(EXIT_CODES.PORT_CONFLICT)
|
||||
}
|
||||
Sentry.captureException(error)
|
||||
console.error('Failed to start server:', error)
|
||||
process.exit(EXIT_CODES.GENERAL_ERROR)
|
||||
|
||||
@@ -231,7 +231,6 @@ export class Application {
|
||||
console.error(
|
||||
`[FATAL] Failed to start ${serverName} on port ${port}: ${errorMsg}`,
|
||||
)
|
||||
Sentry.captureException(error)
|
||||
|
||||
if (isPortInUseError(error)) {
|
||||
console.error(
|
||||
@@ -240,6 +239,7 @@ export class Application {
|
||||
process.exit(EXIT_CODES.PORT_CONFLICT)
|
||||
}
|
||||
|
||||
Sentry.captureException(error)
|
||||
process.exit(EXIT_CODES.GENERAL_ERROR)
|
||||
}
|
||||
|
||||
@@ -255,7 +255,9 @@ export class Application {
|
||||
{ port },
|
||||
)
|
||||
}
|
||||
Sentry.captureException(error)
|
||||
if (!isPortInUseError(error)) {
|
||||
Sentry.captureException(error)
|
||||
}
|
||||
}
|
||||
|
||||
private logStartupSummary(controllerServerStarted: boolean): void {
|
||||
|
||||
Reference in New Issue
Block a user