Skip to content

CreatePersistentSubscriptionAsync only checks inner exception #139

@StevenBlair123

Description

@StevenBlair123

Describe the bug
When an Exception occurs when starting a projection (becasue it doesnt exist) our code does the following:


 if (e.InnerException != null && e.InnerException.Message == "Subscription not found")
  {
                    //Create the Group
                    await this.EventStoreConnection.CreatePersistentSubscriptionAsync(persistentSubscriptionBuilder.StreamName,
                                                                                      persistentSubscriptionBuilder.GroupName,
                                                                                      persistentSubscriptionBuilder.PersistentSubscriptionSettings,
                                                                                      persistentSubscriptionBuilder.UserCredentials);

                    await ConnectToPersistentSubscriptionAsync();
                }
                else
                {
                    throw;
                }

The InnerException is null so it never detects the "Subscription not found" message.

We should check the parent exception as well.

To Reproduce
Create a new projection and attempt to create from a console application (i thinkt this is the important part)

Expected behavior
The code should detect the message that the persistent subscription does not exist, and attempt to create it

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions