From 2a3c2d60cadbae348632ad9f2023367c5ea1e905 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 15 May 2021 19:22:13 +0800 Subject: refactor: Move strings to resource. --- BackEnd/Timeline/SignalRHub/TimelineHub.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'BackEnd/Timeline/SignalRHub/TimelineHub.cs') diff --git a/BackEnd/Timeline/SignalRHub/TimelineHub.cs b/BackEnd/Timeline/SignalRHub/TimelineHub.cs index 2ad7bd66..0bfda84c 100644 --- a/BackEnd/Timeline/SignalRHub/TimelineHub.cs +++ b/BackEnd/Timeline/SignalRHub/TimelineHub.cs @@ -32,19 +32,19 @@ namespace Timeline.SignalRHub var timelineId = await _timelineService.GetTimelineIdByNameAsync(timelineName); var user = Context.User; if (!user.HasPermission(UserPermission.AllTimelineManagement) && !await _timelineService.HasReadPermissionAsync(timelineId, user.GetOptionalUserId())) - throw new HubException("Forbidden."); + throw new HubException(Resource.MessageForbidden); var group = GenerateTimelinePostChangeListeningGroupName(timelineName); await Groups.AddToGroupAsync(Context.ConnectionId, group); - _logger.LogInformation("Add connection {0} to group {1}", Context.ConnectionId, group); + _logger.LogInformation(Resource.LogSubscribeTimelinePostChange, Context.ConnectionId, group); } catch (ArgumentException) { - throw new HubException("Timeline name is illegal."); + throw new HubException(Resource.MessageTimelineNameInvalid); } catch (EntityNotExistException) { - throw new HubException("Timeline not exist."); + throw new HubException(Resource.MessageTimelineNotExist); } } @@ -52,7 +52,7 @@ namespace Timeline.SignalRHub { var group = GenerateTimelinePostChangeListeningGroupName(timelineName); await Groups.RemoveFromGroupAsync(Context.ConnectionId, group); - _logger.LogInformation("Remove connection {0} from group {1}", Context.ConnectionId, group); + _logger.LogInformation(Resource.LogUnsubscribeTimelinePostChange, Context.ConnectionId, group); } } } -- cgit v1.2.3