-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathapp.gateway.ts
More file actions
25 lines (22 loc) · 717 Bytes
/
app.gateway.ts
File metadata and controls
25 lines (22 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { SubscribeMessage, WebSocketGateway, MessageBody, WsException } from '@nestjs/websockets';
import * as Sentry from '@sentry/nestjs';
@WebSocketGateway()
export class AppGateway {
@SubscribeMessage('test-exception')
handleTestException() {
throw new Error('This is an exception in a WebSocket handler');
}
@SubscribeMessage('test-ws-exception')
handleWsException() {
throw new WsException('Expected WS exception');
}
@SubscribeMessage('test-manual-capture')
handleManualCapture() {
try {
throw new Error('Manually captured WebSocket error');
} catch (e) {
Sentry.captureException(e);
}
return { event: 'capture-response', data: { success: true } };
}
}