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

Message rejection of asynchronous interceptors not reported back to the sender #147

Closed
danielwiehl opened this issue Apr 29, 2022 · 0 comments
Assignees

Comments

@danielwiehl
Copy link
Collaborator

Describe the bug

Messages and intents can be intercepted by registering an interceptor. The chain of interceptors can be continued synchronously or asynchronously. However, if an asynchronous interceptor is installed, errors are no longer reported back to the sender from the first asynchronous interceptor onwards.

To Reproduce

Steps to reproduce the behavior:

  1. Install two interceptors
  2. Continue the chain asynchronously in the first interceptor
  3. Report an error in the second interceptor
  4. See that the error is not transported to the sender

Expected behavior

Errors thrown by asynchronous interceptors or subsequent interceptors are reported back to the sender.

@mofogasy mofogasy self-assigned this Aug 19, 2022
mofogasy added a commit that referenced this issue Aug 19, 2022
…back to the sender

closes #147

BREAKING CHANGE: Fixing message rejection reporting of interceptors introduced a breaking change in the Interceptor API.

In order to report asynchronous message rejection correctly, the Interceptor API has been refactored from synchronous to asynchronous message interception. To migrate, change the return type of your interceptors from `void` to `Promise<void>` and update the method body accordingly.

### The following snippets illustrate how a migration could look like:

#### Before migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): void {
    console.log(message);

    // Passes the message along the interceptor chain.
    next.handle(message);
  }
}
```

#### After migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public async intercept(message: TopicMessage, next: Handler<TopicMessage>): Promise<void> {
    console.log(message);

    // Passes the message along the interceptor chain.
    await next.handle(message);
  }
}
```
mofogasy added a commit that referenced this issue Aug 19, 2022
…back to the sender

closes #147

BREAKING CHANGE: Fixing message rejection reporting of interceptors introduced a breaking change in the Interceptor API.

In order to report asynchronous message rejection correctly, the Interceptor API has been refactored from synchronous to asynchronous message interception. To migrate, change the return type of your interceptors from `void` to `Promise<void>` and update the method body accordingly.

### The following snippets illustrate how a migration could look like:

#### Before migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): void {
    console.log(message);

    // Passes the message along the interceptor chain.
    next.handle(message);
  }
}
```

#### After migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public async intercept(message: TopicMessage, next: Handler<TopicMessage>): Promise<void> {
    console.log(message);

    // Passes the message along the interceptor chain.
    await next.handle(message);
  }
}
```
mofogasy added a commit that referenced this issue Aug 19, 2022
…back to the sender

closes #147

BREAKING CHANGE: Fixing message rejection reporting of interceptors introduced a breaking change in the Interceptor API.

In order to report asynchronous message rejection correctly, the Interceptor API has been refactored from synchronous to asynchronous message interception. To migrate, change the return type of your interceptors from `void` to `Promise<void>` and update the method body accordingly.

### The following snippets illustrate how a migration could look like:

#### Before migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): void {
    console.log(message);

    // Passes the message along the interceptor chain.
    next.handle(message);
  }
}
```

#### After migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): Promise<void> {
    console.log(message);

    // Passes the message along the interceptor chain.
    return next.handle(message);
  }
}
```
mofogasy added a commit that referenced this issue Aug 22, 2022
…back to the sender

closes #147

BREAKING CHANGE: Fixing message rejection reporting of interceptors introduced a breaking change in the Interceptor API.

In order to report asynchronous message rejection correctly, the Interceptor API has been refactored from synchronous to asynchronous message interception. To migrate, change the return type of your interceptors from `void` to `Promise<void>` and update the method body accordingly.

### The following snippets illustrate how a migration could look like:

#### Before migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): void {
    console.log(message);

    // Passes the message along the interceptor chain.
    next.handle(message);
  }
}
```

#### After migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): Promise<void> {
    console.log(message);

    // Passes the message along the interceptor chain.
    return next.handle(message);
  }
}
```
mofogasy added a commit that referenced this issue Aug 22, 2022
…back to the sender

closes #147

BREAKING CHANGE: Fixing message rejection reporting of interceptors introduced a breaking change in the Interceptor API.

In order to report asynchronous message rejection correctly, the Interceptor API has been refactored from synchronous to asynchronous message interception. To migrate, change the return type of your interceptors from `void` to `Promise<void>` and update the method body accordingly.

### The following snippets illustrate how a migration could look like:

#### Before migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): void {
    console.log(message);

    // Passes the message along the interceptor chain.
    next.handle(message);
  }
}
```

#### After migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): Promise<void> {
    console.log(message);

    // Passes the message along the interceptor chain.
    return next.handle(message);
  }
}
```
mofogasy added a commit that referenced this issue Sep 30, 2022
…back to the sender

closes #147

BREAKING CHANGE: Fixing message rejection reporting of interceptors introduced a breaking change in the Interceptor API.

Note: The messaging protocol between host and client HAS NOT CHANGED.

In order to report asynchronous message rejection correctly, the Interceptor API has been refactored from synchronous to asynchronous message interception. To migrate, change the return type of your interceptors from `void` to `Promise<void>` and update the method body accordingly.

### The following snippets illustrate how a migration could look like:

#### Before migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): void {
    console.log(message);

    // Passes the message along the interceptor chain.
    next.handle(message);
  }
}
```

#### After migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): Promise<void> {
    console.log(message);

    // Passes the message along the interceptor chain.
    return next.handle(message);
  }
}
```
mofogasy added a commit that referenced this issue Sep 30, 2022
…back to the sender

closes #147

BREAKING CHANGE: Fixing message rejection reporting of interceptors introduced a breaking change in the Interceptor API.

Note: The messaging protocol between host and client HAS NOT CHANGED.

In order to report asynchronous message rejection correctly, the Interceptor API has been refactored from synchronous to asynchronous message interception. To migrate, change the return type of your interceptors from `void` to `Promise<void>` and update the method body accordingly.

### The following snippets illustrate how a migration could look like:

#### Before migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): void {
    console.log(message);

    // Passes the message along the interceptor chain.
    next.handle(message);
  }
}
```

#### After migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): Promise<void> {
    console.log(message);

    // Passes the message along the interceptor chain.
    return next.handle(message);
  }
}
```
mofogasy added a commit that referenced this issue Sep 30, 2022
…back to the sender

closes #147

BREAKING CHANGE: Fixing message rejection reporting of interceptors introduced a breaking change in the Interceptor API.

Note: The messaging protocol between host and client HAS NOT CHANGED.

In order to report asynchronous message rejection correctly, the Interceptor API has been refactored from synchronous to asynchronous message interception. To migrate, change the return type of your interceptors from `void` to `Promise<void>` and update the method body accordingly.

### The following snippets illustrate how a migration could look like:

#### Before migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): void {
    console.log(message);

    // Passes the message along the interceptor chain.
    next.handle(message);
  }
}
```

#### After migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): Promise<void> {
    console.log(message);

    // Passes the message along the interceptor chain.
    return next.handle(message);
  }
}
```
mofogasy added a commit that referenced this issue Sep 30, 2022
…back to the sender

closes #147

BREAKING CHANGE: Fixing message rejection reporting of interceptors introduced a breaking change in the Interceptor API.

Note: The messaging protocol between host and client HAS NOT CHANGED.

In order to report asynchronous message rejection correctly, the Interceptor API has been refactored from synchronous to asynchronous message interception. To migrate, change the return type of your interceptors from `void` to `Promise<void>` and update the method body accordingly.

### The following snippets illustrate how a migration could look like:

#### Before migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): void {
    console.log(message);

    // Passes the message along the interceptor chain.
    next.handle(message);
  }
}
```

#### After migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): Promise<void> {
    console.log(message);

    // Passes the message along the interceptor chain.
    return next.handle(message);
  }
}
```
mofogasy added a commit that referenced this issue Sep 30, 2022
…back to the sender

closes #147

BREAKING CHANGE: Fixing message rejection reporting of interceptors introduced a breaking change in the Interceptor API.

Note: The messaging protocol between host and client HAS NOT CHANGED.

In order to report asynchronous message rejection correctly, the Interceptor API has been refactored from synchronous to asynchronous message interception. To migrate, change the return type of your interceptors from `void` to `Promise<void>` and update the method body accordingly.

### The following snippets illustrate how a migration could look like:

#### Before migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): void {
    console.log(message);

    // Passes the message along the interceptor chain.
    next.handle(message);
  }
}
```

#### After migration

```typescript
class MessageLoggerInterceptor implements MessageInterceptor {
  public intercept(message: TopicMessage, next: Handler<TopicMessage>): Promise<void> {
    console.log(message);

    // Passes the message along the interceptor chain.
    return next.handle(message);
  }
}
```
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

No branches or pull requests

2 participants