Skip to content

Exception should be passed directly to logger instead of using ex.ToString() in UpdatePluginConfigHandler #746

@ziagham

Description

@ziagham

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/UpdatePluginConfig/UpdatePluginConfigHandler.cs
Lines: 99 and 100

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<Unit>.FailAsync(ex.ToString());
}

Proposed fix

catch (FlowSynxException ex)
{
    _logger.LogError(ex, "An error occurred while processing the request.");
    return await Result<Unit>.FailAsync(ex.Message);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions