Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
InspectorProxy
: Don't pass an Error
object to socket.close()
Summary: Currently our error handling for websocket connections in `InspectorProxy` passes whatever is thrown as an "error explanation" to `socket.close()`. This argument expects `string | undefined` (NB `null` is also invalid) In cases where we're catching and passing an `Error`, this causes the socket instance to emit its own `'error'`, which we don't have any listener for, causing a crash. This diff uses `e?.toString() ?? 'Unknown error'` to: - Preserve the current behaviour for raw strings - Show `Error: ${e.message}` when `e instanceof Error` - Show `Unknown error` when `e == null`. Changelog: **Fix:** Prevent `InspectorProxy` connection errors crashing the process. Reviewed By: motiz88 Differential Revision: D36479972 fbshipit-source-id: 622be8c5f6bc516dd3bf9115445c7fca9c841409
- Loading branch information