Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lencioni
Copy link
Contributor

@lencioni lencioni commented Dec 5, 2025

Handle 409 status codes from cancel job API endpoint

This happens when the job has already been completed. This is normal
behavior, so we don't want to throw here.

We should possibly also handle 404 this way, which happens when no job
is found for the pair of SHAs. I see that error reported fairly
frequently, but I don't really understand how it comes about yet, so I
don't want to jump into it here just yet.


Pass error message through when canceling jobs

This will update the job with some more useful information.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances error handling for the job cancellation endpoint by gracefully handling 409 status codes (when a job is already completed) and improves error messaging by passing through the actual error message instead of relying on the environment's message field.

  • Adds try-catch error handling for 409 responses from the cancel job API
  • Refactors cancelJob to accept message as a direct parameter instead of extracting it from EnvironmentResult
  • Updates the error log message to include integration type context

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/network/cancelJob.ts Imports ErrorWithStatusCode, adds message as explicit parameter, wraps API call in try-catch to handle 409 status codes gracefully
src/cli/index.ts Constructs error message from caught exception and passes it directly to cancelJob instead of relying on environment.message

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lencioni lencioni force-pushed the cancel-status-codes branch from e80b211 to a43c113 Compare December 5, 2025 15:53
This happens when the job has already been completed. This is normal
behavior, so we don't want to throw here.

We should possibly also handle 404 this way, which happens when no job
is found for the pair of SHAs. I see that error reported fairly
frequently, but I don't really understand how it comes about yet, so I
don't want to jump into it here just yet.
This will update the job with some more useful information.
@lencioni lencioni force-pushed the cancel-status-codes branch from a43c113 to 7af205d Compare December 5, 2025 15:59
@lencioni lencioni merged commit fea0d7d into main Dec 8, 2025
13 checks passed
@lencioni lencioni deleted the cancel-status-codes branch December 8, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants