Java: add exception handler when receiving webhook events
This commit is contained in:
parent
74a7ff2365
commit
7ded4450b7
@ -50,8 +50,12 @@ public class Controller {
|
||||
@PostMapping(value = "/webhook", consumes = "application/webhook+json")
|
||||
public void receiveWebhook(@RequestHeader("Authorization") String authHeader, @RequestBody String body) {
|
||||
WebhookReceiver webhookReceiver = new WebhookReceiver(LIVEKIT_API_KEY, LIVEKIT_API_SECRET);
|
||||
LivekitWebhook.WebhookEvent event = webhookReceiver.receive(body, authHeader);
|
||||
System.out.println("LiveKit Webhook: " + event.toString());
|
||||
try {
|
||||
LivekitWebhook.WebhookEvent event = webhookReceiver.receive(body, authHeader);
|
||||
System.out.println("LiveKit Webhook: " + event.toString());
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error validating webhook event: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user