Skip to content

Conversation

@seefeldb
Copy link
Contributor

No description provided.

Copy link
Contributor

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 logging in worker errors by introducing a type guard function to verify additional error metadata.

  • Adds isErrorWithContext to check for error properties.
  • Updates exports in runner/src/index.ts to include the new function and error types.
  • Modifies worker.ts to log extended details when error context is present.

Reviewed Changes

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

File Description
runner/src/scheduler.ts Added isErrorWithContext function for error metadata validation.
runner/src/index.ts Export updated to include isErrorWithContext and extended types.
background-charm-service/src/worker.ts Updated error logging to output extended error details if available.

recipeId: string;
};

export function isErrorWithContext(error: unknown): error is ErrorWithContext {
Copy link

Copilot AI Mar 31, 2025

Choose a reason for hiding this comment

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

The type 'ErrorWithContext' only defines 'recipeId', yet the function checks for additional properties ('action', 'charmId', 'space'). Consider updating the ErrorWithContext type to include these properties or modifying the guard to align with the existing type definition.

Copilot uses AI. Check for mistakes.
@seefeldb seefeldb merged commit d72edfb into main Mar 31, 2025
6 checks passed
@seefeldb seefeldb deleted the log-metadata-in-worker-errors branch March 31, 2025 21:28
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.

2 participants