File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,11 +6,24 @@ import { HandleHttpSourceService } from "~/services/sources/handleHttpSource.ser
66export async function action ( { request, params } : ActionArgs ) {
77 logger . info ( "Handling http source" , { url : request . url } ) ;
88
9- const { id } = z . object ( { id : z . string ( ) } ) . parse ( params ) ;
10-
11- const service = new HandleHttpSourceService ( ) ;
12-
13- return await service . call ( id , request ) ;
9+ try {
10+ const { id } = z . object ( { id : z . string ( ) } ) . parse ( params ) ;
11+ const service = new HandleHttpSourceService ( ) ;
12+ const result = await service . call ( id , request ) ;
13+
14+ return new Response ( undefined , {
15+ status : result . status ,
16+ } ) ;
17+ } catch ( e ) {
18+ if ( e instanceof Error ) {
19+ logger . error ( "Error handling http source" , { error : e . message } ) ;
20+ } else {
21+ logger . error ( "Error handling http source" , { error : JSON . stringify ( e ) } ) ;
22+ }
23+ return new Response ( undefined , {
24+ status : 500 ,
25+ } ) ;
26+ }
1427}
1528
1629export async function loader ( { request, params } : LoaderArgs ) {
You can’t perform that action at this time.
0 commit comments