From 2b6a58ff04cc11d11ab5a88b941934467d9663e3 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 7 Oct 2025 16:41:18 +0500 Subject: [PATCH] api: handle subscription fetch errors --- Notesnook.API/Services/S3Service.cs | 2 +- Notesnook.API/Services/UserService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Notesnook.API/Services/S3Service.cs b/Notesnook.API/Services/S3Service.cs index a4619b1..d940d1b 100644 --- a/Notesnook.API/Services/S3Service.cs +++ b/Notesnook.API/Services/S3Service.cs @@ -230,7 +230,7 @@ namespace Notesnook.API.Services if (userId == null || objectName == null) throw new Exception("Could not abort multipart upload."); var subscriptionService = await WampServers.SubscriptionServer.GetServiceAsync(SubscriptionServerTopics.UserSubscriptionServiceTopic); - var subscription = await subscriptionService.GetUserSubscriptionAsync(Clients.Notesnook.Id, userId); + var subscription = await subscriptionService.GetUserSubscriptionAsync(Clients.Notesnook.Id, userId) ?? throw new Exception("User subscription not found."); long fileSize = await GetMultipartUploadSizeAsync(userId, uploadRequest.Key, uploadRequest.UploadId); if (StorageHelper.IsFileSizeExceeded(subscription, fileSize)) diff --git a/Notesnook.API/Services/UserService.cs b/Notesnook.API/Services/UserService.cs index cc853b8..54f311b 100644 --- a/Notesnook.API/Services/UserService.cs +++ b/Notesnook.API/Services/UserService.cs @@ -118,7 +118,7 @@ namespace Notesnook.API.Services else { var subscriptionService = await WampServers.SubscriptionServer.GetServiceAsync(SubscriptionServerTopics.UserSubscriptionServiceTopic); - subscription = await subscriptionService.GetUserSubscriptionAsync(Clients.Notesnook.Id, userId); + subscription = await subscriptionService.GetUserSubscriptionAsync(Clients.Notesnook.Id, userId) ?? throw new Exception("User subscription not found."); } var userSettings = await Repositories.UsersSettings.FindOneAsync((u) => u.UserId == user.UserId) ?? throw new Exception("User settings not found.");