@@ -2,7 +2,11 @@ import type { Handler } from "hono";
22import { upgradeWebSocket } from "hono/bun" ;
33
44import type { AppBindings } from "./hono-bindings" ;
5- import { createProxyFromRequest , normalizeWsData , WsProxyConnection } from "./stt" ;
5+ import {
6+ createProxyFromRequest ,
7+ normalizeWsData ,
8+ WsProxyConnection ,
9+ } from "./stt" ;
610
711export const listenSocketHandler : Handler < AppBindings > = async ( c , next ) => {
812 const emit = c . get ( "emit" ) ;
@@ -21,9 +25,11 @@ export const listenSocketHandler: Handler<AppBindings> = async (c, next) => {
2125 type : "stt.websocket.error" ,
2226 userId,
2327 provider,
24- error : error instanceof Error ? error : new Error ( "upstream_connect_failed" ) ,
28+ error :
29+ error instanceof Error ? error : new Error ( "upstream_connect_failed" ) ,
2530 } ) ;
26- const detail = error instanceof Error ? error . message : "upstream_connect_failed" ;
31+ const detail =
32+ error instanceof Error ? error . message : "upstream_connect_failed" ;
2733 const status = detail === "upstream_connect_timeout" ? 504 : 502 ;
2834 return c . json ( { error : "upstream_connect_failed" , detail } , status ) ;
2935 }
@@ -58,7 +64,10 @@ export const listenSocketHandler: Handler<AppBindings> = async (c, next) => {
5864 type : "stt.websocket.error" ,
5965 userId,
6066 provider,
61- error : event instanceof Error ? event : new Error ( "websocket_client_error" ) ,
67+ error :
68+ event instanceof Error
69+ ? event
70+ : new Error ( "websocket_client_error" ) ,
6271 } ) ;
6372 connection . closeConnections ( 1011 , "client_error" ) ;
6473 } ,
0 commit comments