Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: throw a more meaningful error message if Saga Id is not set #1098

Merged

Conversation

AlexZeitler
Copy link
Contributor

@AlexZeitler AlexZeitler commented Oct 24, 2024

This code

public class Order : Saga
{
  public string? Id { get; set; }

  public object[] Start(
    OrderPlaced orderPlaced
  ) => [new BillOrder(orderPlaced.OrderId)];

  ...
}

leads to this error message currently:

Envelope Envelope #0192bea2-f2a8-4536-9ffb-9a2ecc2ab466/CorrelationId=908b7494-c052-43a0-88e5-0494374ff2bb (Messages.OrderPlaced) from Sales to rabbitmq://queue/placedorders-shipping was moved to the error queue
      System.InvalidOperationException: Type Shipping.Order does not have a public Id property
         at Wolverine.Persistence.Sagas.InMemorySagaPersistor.Store[T](T document) in /home/runner/work/wolverine/wolverine/src/Wolverine/Persistence/Sagas/InMemorySagaPersistor.cs:line 37
         at Internal.Generated.WolverineHandlers.OrderPlacedHandler1858006213.HandleAsync(MessageContext context, CancellationToken cancellation)
         at Wolverine.Runtime.Handlers.Executor.ExecuteAsync(MessageContext context, CancellationToken cancellation) in /home/runner/work/wolverine/wolverine/src/Wolverine/Runtime/Handlers/Executor.cs:line 164

New text will be:

Type Shipping.Order Id property must be set to a non-null value.

@jeremydmiller jeremydmiller merged commit 8b32157 into JasperFx:main Oct 26, 2024
1 check passed
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