@@ -578,18 +578,26 @@ async def propose_dao_action_send_message(
578578 logger .warning (
579579 f"Airdrop transaction { payload .airdrop_txid } not found"
580580 )
581- raise HTTPException (
581+ return JSONResponse (
582582 status_code = 404 ,
583- detail = f"Airdrop transaction { payload .airdrop_txid } not found" ,
583+ content = {
584+ "success" : False ,
585+ "output" : {},
586+ "error" : f"Airdrop transaction { payload .airdrop_txid } not found" ,
587+ },
584588 )
585589
586590 if airdrop .proposal_id :
587591 logger .warning (
588592 f"Airdrop transaction { payload .airdrop_txid } has already been used in proposal with ID: { airdrop .proposal_id } "
589593 )
590- raise HTTPException (
594+ return JSONResponse (
591595 status_code = 400 ,
592- detail = f"Airdrop transaction { payload .airdrop_txid } has already been used in another proposal" ,
596+ content = {
597+ "success" : False ,
598+ "output" : {},
599+ "error" : f"Airdrop transaction { payload .airdrop_txid } has already been used in another proposal" ,
600+ },
593601 )
594602
595603 # Validate airdrop expiry
@@ -603,9 +611,13 @@ async def propose_dao_action_send_message(
603611 logger .warning (
604612 f"Airdrop validation failed for tx { payload .airdrop_txid } : { expiry_error } "
605613 )
606- raise HTTPException (
614+ return JSONResponse (
607615 status_code = 400 ,
608- detail = f"Airdrop expired: { expiry_error } " ,
616+ content = {
617+ "success" : False ,
618+ "output" : {},
619+ "error" : f"Airdrop expired: { expiry_error } " ,
620+ },
609621 )
610622 except HTTPException :
611623 raise
@@ -621,9 +633,13 @@ async def propose_dao_action_send_message(
621633 logger .warning (
622634 f"Airdrop cooldown validation failed for tx { payload .airdrop_txid } : { cooldown_violations } "
623635 )
624- raise HTTPException (
636+ return JSONResponse (
625637 status_code = 400 ,
626- detail = f"Airdrop cooldown violations: { list (cooldown_violations .values ())[0 ]} " ,
638+ content = {
639+ "success" : False ,
640+ "output" : {},
641+ "error" : f"Airdrop cooldown violations: { list (cooldown_violations .values ())[0 ]} " ,
642+ },
627643 )
628644
629645 # Validate recipients against wallets table
@@ -640,10 +656,14 @@ async def propose_dao_action_send_message(
640656 f"Airdrop recipient validation failed for tx { payload .airdrop_txid } : "
641657 f"Invalid recipients not in wallets table: { invalid_recipients } "
642658 )
643- raise HTTPException (
644- status_code = 400 ,
645- detail = f"Invalid airdrop recipients not found in wallets table: { invalid_recipients } " ,
646- )
659+ return JSONResponse (
660+ status_code = 400 ,
661+ content = {
662+ "success" : False ,
663+ "output" : {},
664+ "error" : f"Invalid airdrop recipients not found in wallets table: { invalid_recipients } " ,
665+ },
666+ )
647667
648668 except HTTPException :
649669 raise
0 commit comments