TheFo2sh / AsyncFlow

Integrate asynchronous job flows with ease in your .NET applications. AsyncFlow is designed for web applications that use a pattern where users call an invoke API, receive a job ID, and can then track and retrieve the job's results using separate endpoints.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors Endpoint

TheFo2sh opened this issue · comments

New Endpoint Proposal: Fetching Job Errors

Issue Type: Feature Request

Description:
As we continue to evolve the AsyncFlow library, it's become apparent that there's a potential gap in our error-handling capabilities. Currently, while users can track the status of their jobs, there isn't a straightforward way to fetch detailed error information in case a job fails. This can be invaluable for both developers and end-users to understand what might have gone wrong.

Proposal:
Introduce a new endpoint:
/{flowName}/{jobId}/error

This endpoint will return detailed error information if the corresponding job encounters a failure.

Response Structure (proposed):

{
    "JobId": "unique-job-id",
    "Error": {
        "Type": "ExceptionType",
        "Message": "Detailed error message",
        "StackTrace": "Stack trace details..."
    }
}

Customization:
In line with the ethos of flexibility that AsyncFlow offers, we should also provide users with the ability to customize the error response. This can be achieved by incorporating a Func<Exception, IResult> within the AsyncFlowEndpointConfigurator, allowing users to modify the default error output or even introduce additional logging mechanisms.

Benefits:

  • Provides clearer insights into job failures.
  • Enhances user experience by offering detailed feedback.
  • Allows users to tailor error outputs, making it adaptable for various applications.

Implementation Steps (tentative):

  1. Design the endpoint structure.
  2. Integrate it with the job execution flow to capture and relay errors.
  3. Implement the customization mechanism through AsyncFlowEndpointConfigurator.
  4. Update documentation and provide examples.

closed by commit
#4