@@ -254,25 +254,46 @@ export default eventHandler(async (event) => {
254254 } ,
255255 ) ;
256256 } else {
257- await installation . request (
258- "POST /repos/{owner}/{repo}/issues/{issue_number}/comments" ,
259- {
260- owner : workflowData . owner ,
261- repo : workflowData . repo ,
262- issue_number : Number ( workflowData . ref ) ,
263- body : generatePullRequestPublishMessage (
264- origin ,
265- templatesHtmlMap ,
266- packagesWithoutPrefix ,
267- workflowData ,
268- compact ,
269- onlyTemplates ,
270- checkRunUrl ,
271- packageManager ,
272- comment === "update" ? "ref" : "sha" ,
273- ) ,
274- } ,
275- ) ;
257+ try {
258+ await installation . request (
259+ "POST /repos/{owner}/{repo}/issues/{issue_number}/comments" ,
260+ {
261+ owner : workflowData . owner ,
262+ repo : workflowData . repo ,
263+ issue_number : Number ( workflowData . ref ) ,
264+ body : generatePullRequestPublishMessage (
265+ origin ,
266+ templatesHtmlMap ,
267+ packagesWithoutPrefix ,
268+ workflowData ,
269+ compact ,
270+ onlyTemplates ,
271+ checkRunUrl ,
272+ packageManager ,
273+ comment === "update" ? "ref" : "sha" ,
274+ ) ,
275+ } ,
276+ ) ;
277+ } catch ( error ) {
278+ throw createError ( {
279+ statusCode : 500 ,
280+ message : `Failed to create pull request comment. Details:
281+ Error: ${ error instanceof Error ? error . message : String ( error ) }
282+ Context:
283+ - Owner: ${ workflowData . owner }
284+ - Repo: ${ workflowData . repo }
285+ - Issue Number: ${ Number ( workflowData . ref ) }
286+ - Origin: ${ origin }
287+ - Templates: ${ JSON . stringify ( templatesHtmlMap ) }
288+ - Packages: ${ packagesWithoutPrefix . join ( ', ' ) }
289+ - Workflow Data: ${ JSON . stringify ( workflowData ) }
290+ - Compact: ${ compact }
291+ - Only Templates: ${ onlyTemplates }
292+ - Check Run URL: ${ checkRunUrl }
293+ - Package Manager: ${ packageManager }
294+ - Comment Type: ${ comment === "update" ? "ref" : "sha" } ` ,
295+ } ) ;
296+ }
276297 }
277298 }
278299 }
0 commit comments