Skip to content

Feature/catch and publish exception#127

Open
Jeff-Xu23 wants to merge 5 commits intodevfrom
feature/catch-and-publish-exception
Open

Feature/catch and publish exception#127
Jeff-Xu23 wants to merge 5 commits intodevfrom
feature/catch-and-publish-exception

Conversation

@Jeff-Xu23
Copy link
Contributor

catch and publish exception to orleans stream

@codecov
Copy link

codecov bot commented Apr 29, 2025

Codecov Report

Attention: Patch coverage is 89.01099% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ar.Core/Extensions/ExceptionPublisherExtensions.cs 85.91% 8 Missing and 2 partials ⚠️
Files with missing lines Coverage Δ
src/Aevatar.Core.Abstractions/AevatarOptions.cs 100.00% <100.00%> (ø)
...Aevatar.Core.Abstractions/Events/ExceptionEvent.cs 100.00% <100.00%> (ø)
src/Aevatar.Core/GAgentBase.cs 71.31% <100.00%> (+1.06%) ⬆️
...ar.Core/Extensions/ExceptionPublisherExtensions.cs 85.91% <85.91%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

namespace Aevatar.Core.Abstractions;

[GenerateSerializer]
public class ExceptionEvent : EventBase
Copy link
Contributor

Choose a reason for hiding this comment

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

could you add GrainType, EventType and the original Event object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
catch (Exception serializationEx)
{
contextDataJson = $"{{\"error\":\"Failed to serialize context data: {serializationEx.Message}\"}}";
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we log warning here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think just printing debug logs is sufficient, as this is normal logic processing and there are no abnormal or illogical situations occurring here.


// Extract class name
string? className = null;
if (!string.IsNullOrEmpty(callerClassName))
Copy link
Contributor

Choose a reason for hiding this comment

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

let's enforce called to pass this value instead using reflection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

/// <param name="callerMemberName">Caller method name, auto-populated</param>
/// <param name="callerClassName">Caller class name, auto-populated</param>
/// <returns>If the operation succeeds, returns the operation result; if an exception occurs and is not rethrown, returns the default value</returns>
public static async Task<(T Result, Guid ExceptionId)> CatchAndPublishExceptionAsync<T>(
Copy link
Contributor

Choose a reason for hiding this comment

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

let's not using this method as it swallow the original StackTrace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method has certain use cases, so it is recommended to keep it.

Copy link
Contributor

@eanzhao eanzhao left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Stream Error Handling to push unhandled messages to a new Topic specifically used for error handling

3 participants