-
Notifications
You must be signed in to change notification settings - Fork 26
Exception should be passed directly to logger instead of using ex.ToString() in AddPluginConfigHandler #744
Copy link
Copy link
Labels
C#C# related codeC# related codeMaintainabilitybugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
What version of FlowSynx?
1.2.4
Describe the bug
The exception is being logged using ex.ToString(), which prevents the logger from properly capturing structured exception details such as stack trace, message, and inner exceptions in a standardized way.
File: src/FlowSynx.Application/Features/PluginConfig/Command/AddPluginConfig/AddPluginConfigHandler.cs
Lines: 101 and 102
Why is this an issue
- Logging
ex.ToString()hides structured exception information. - Microsoft.Extensions.Logging and other providers rely on the overload that accepts the exception object to produce rich logs.
- Makes it harder to search, filter, and correlate logs.
- Inconsistent with standard .NET logging practices.
Current code
catch (FlowSynxException ex)
{
_logger.LogError(ex.ToString());
return await Result<AddPluginConfigResponse>.FailAsync(ex.ToString());;
}Proposed fix
catch (FlowSynxException ex)
{
_logger.LogError(ex, "An error occurred while adding plugin configuration.");
return await Result<AddPluginConfigResponse>.FailAsync(ex.Message);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C#C# related codeC# related codeMaintainabilitybugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed