File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
agent-manager/src/controller Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -6,17 +6,22 @@ const router = Router()
66
77async function blockfrostHealthCheck ( req : Request , res : Response ) {
88 const url = `https://cardano-${ environments . networkName } .blockfrost.io/api/v0/health`
9- const response = await fetch ( url , {
10- method : 'GET' ,
11- headers : {
12- project_id : environments . blockFrostApiKey ,
13- } ,
14- } )
15- const respJson = await response . json ( )
16- if ( response . status != 200 ) {
17- console . log ( 'BlockFrostCheckError : ' , respJson )
9+ try {
10+ const response = await fetch ( url , {
11+ method : 'GET' ,
12+ headers : {
13+ project_id : environments . blockFrostApiKey ,
14+ } ,
15+ } )
16+ const respJson = await response . json ( )
17+ if ( response . status != 200 ) {
18+ console . log ( 'BlockFrostCheckError : ' , respJson )
19+ }
20+ return res . status ( response . status ) . send ( respJson )
21+ } catch ( err : any ) {
22+ console . log ( 'BlockFrostCheckError : ' , err )
23+ return res . status ( 500 ) . send ( { error : err . message ? err . message : err } )
1824 }
19- return res . status ( response . status ) . send ( respJson )
2025}
2126
2227router . get ( '/' , handlerWrapper ( blockfrostHealthCheck ) )
You can’t perform that action at this time.
0 commit comments