1010
1111import sentry_sdk
1212from slack_bolt import App
13+ from pydantic import ValidationError
1314from cachetools import cached , TTLCache
1415from slack_bolt .adapter .socket_mode import SocketModeHandler
1516
@@ -321,10 +322,49 @@ def laas_jira(event, say, collection: PICollection):
321322 reporter_email = slack .user_map .get (slack .item_user , {}).get ('email' ) or outside_slack_jira_user_map (slack .item_user )
322323 assignee_email = slack .user_map .get (slack .reaction_user , {}).get ('email' ) or outside_slack_jira_user_map (slack .reaction_user )
323324
324- issue = Issue .model_validate (gpt_metadata )
325+ try :
326+ issue = Issue .model_validate (gpt_metadata )
327+ except ValidationError :
328+ slack .say (
329+ channel = slack .reaction_user ,
330+ blocks = [
331+ {
332+ "type" : "header" ,
333+ "text" : {
334+ "type" : "plain_text" ,
335+ "text" : "Jira 이슈 생성에 실패했습니다."
336+ }
337+ },
338+ {
339+ "type" : "section" ,
340+ "text" : {
341+ "type" : "plain_text" ,
342+ "text" : "이슈 타입별로 필수적인 필드가 있습니다. 필수 필드가 누락되지 않았는지 확인해보세요" ,
343+ }
344+ },
345+ {
346+ "type" : "context" ,
347+ "elements" : [
348+ {
349+ "type" : "mrkdwn" ,
350+ "text" : f"<{ slack .link } |스레드 바로가기>"
351+ }
352+ ]
353+ },
354+ {
355+ "type" : "context" ,
356+ "elements" : [
357+ {
358+ "type" : "mrkdwn" ,
359+ "text" : f"Error Message: ```{ str (e )} ```"
360+ }
361+ ]
362+ },
363+ ]
364+ )
365+ raise e
325366
326367 jira = JiraOperator ()
327- jira .get_user_id_from_email (assignee_email )
328368 refined_fields = issue .refined_fields (
329369 jira .get_user_id_from_email (reporter_email ),
330370 jira .get_user_id_from_email (assignee_email ),
@@ -348,7 +388,7 @@ def laas_jira(event, say, collection: PICollection):
348388 "type" : "section" ,
349389 "text" : {
350390 "type" : "plain_text" ,
351- "text" : "이슈 타입별로 필수적인 필드가 있습니다. 필수 필드가 누락되지 않았는지 확인해보세요 " ,
391+ "text" : "Jira 설정이 변경되거나, 개발 오류일 수 있습니다. " ,
352392 }
353393 },
354394 {
0 commit comments