Making WordPress.org

Changeset 13099


Ignore:
Timestamp:
01/09/2024 07:49:38 AM (17 months ago)
Author:
dd32
Message:

Trac: GitHub PRs: Catch exceptions that occur when attempting to update the trac ticket.

This is usually caused by Trac rejecting the update, either due to the ticket being modified (which we then retry the update a few times) OR the anti-spam blocking the comment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/webhook.php

    r12116 r13099  
    140140            }
    141141
    142             $trac->update(
    143                 $pr_data->trac_ticket[1],
    144                 "''This ticket was mentioned in [{$pr_data->html_url} PR #{$pr_number}] " .
    145                     "on [https://github.com/{$pr_repo}/ {$pr_repo}] " .
    146                     "by {$authorship}.''" .
    147                     ( $pr_description ? "\n{$pr_description}" : '' ),
    148                 $attributes,  // Attributes changed
    149                 true // Notify
    150             );
     142            try {
     143                $trac->update(
     144                    $pr_data->trac_ticket[1],
     145                    "''This ticket was mentioned in [{$pr_data->html_url} PR #{$pr_number}] " .
     146                        "on [https://github.com/{$pr_repo}/ {$pr_repo}] " .
     147                        "by {$authorship}.''" .
     148                        ( $pr_description ? "\n{$pr_description}" : '' ),
     149                    $attributes,  // Attributes changed
     150                    true // Notify
     151                );
     152            } catch( \Exception $e ) {
     153                // For now, nothing.
     154            }
    151155        }
    152156
     
    232236
    233237            if ( ! $is_edit ) {
    234                 $trac->update(
    235                     $t->ticket, $comment_body,
    236                     [], false,
    237                     $comment_author,
    238                     $comment_time
    239                 );
     238                try {
     239                    $trac->update(
     240                        $t->ticket, $comment_body,
     241                        [], false,
     242                        $comment_author,
     243                        $comment_time
     244                    );
     245                } catch( \Exception $e ) {
     246                    // For now, nothing.
     247                }
    240248            } else {
    241249                // TODO: Need to edit..
Note: See TracChangeset for help on using the changeset viewer.