10
10
11
11
import sentry_sdk
12
12
from slack_bolt import App
13
+ from pydantic import ValidationError
13
14
from cachetools import cached , TTLCache
14
15
from slack_bolt .adapter .socket_mode import SocketModeHandler
15
16
@@ -321,10 +322,49 @@ def laas_jira(event, say, collection: PICollection):
321
322
reporter_email = slack .user_map .get (slack .item_user , {}).get ('email' ) or outside_slack_jira_user_map (slack .item_user )
322
323
assignee_email = slack .user_map .get (slack .reaction_user , {}).get ('email' ) or outside_slack_jira_user_map (slack .reaction_user )
323
324
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
325
366
326
367
jira = JiraOperator ()
327
- jira .get_user_id_from_email (assignee_email )
328
368
refined_fields = issue .refined_fields (
329
369
jira .get_user_id_from_email (reporter_email ),
330
370
jira .get_user_id_from_email (assignee_email ),
@@ -348,7 +388,7 @@ def laas_jira(event, say, collection: PICollection):
348
388
"type" : "section" ,
349
389
"text" : {
350
390
"type" : "plain_text" ,
351
- "text" : "이슈 타입별로 필수적인 필드가 있습니다. 필수 필드가 누락되지 않았는지 확인해보세요 " ,
391
+ "text" : "Jira 설정이 변경되거나, 개발 오류일 수 있습니다. " ,
352
392
}
353
393
},
354
394
{
0 commit comments