diff options
author | crupest <crupest@outlook.com> | 2020-06-04 00:40:19 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-04 00:40:19 +0800 |
commit | 1e918584d1d11525ef7d13fef47fb5a9b84bd1b1 (patch) | |
tree | cc8bc62992b35397f334477b7a591993b00001b8 /Timeline/Models/Http/Timeline.cs | |
parent | 1b9f4bfb2242589463c70b4ad2c77cfc8f79afb0 (diff) | |
download | timeline-1e918584d1d11525ef7d13fef47fb5a9b84bd1b1.tar.gz timeline-1e918584d1d11525ef7d13fef47fb5a9b84bd1b1.tar.bz2 timeline-1e918584d1d11525ef7d13fef47fb5a9b84bd1b1.zip |
chore(back): Fix some warnings.
Diffstat (limited to 'Timeline/Models/Http/Timeline.cs')
-rw-r--r-- | Timeline/Models/Http/Timeline.cs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Timeline/Models/Http/Timeline.cs b/Timeline/Models/Http/Timeline.cs index 9e2aefd0..fb767f10 100644 --- a/Timeline/Models/Http/Timeline.cs +++ b/Timeline/Models/Http/Timeline.cs @@ -58,11 +58,8 @@ namespace Timeline.Models.Http public TimelineInfoLinks Resolve(Timeline source, TimelineInfo destination, TimelineInfoLinks destMember, ResolutionContext context)
{
- if (_actionContextAccessor.ActionContext == null)
- throw new InvalidOperationException("No action context, can't fill urls.");
-
- var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccessor.ActionContext);
-
+ var actionContext = _actionContextAccessor.AssertActionContextForUrlFill();
+ var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext);
return new TimelineInfoLinks
{
@@ -85,10 +82,8 @@ namespace Timeline.Models.Http public TimelinePostContentInfo Resolve(TimelinePost source, TimelinePostInfo destination, TimelinePostContentInfo destMember, ResolutionContext context)
{
- if (_actionContextAccessor.ActionContext == null)
- throw new InvalidOperationException("No action context, can't fill urls.");
-
- var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccessor.ActionContext);
+ var actionContext = _actionContextAccessor.AssertActionContextForUrlFill();
+ var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext);
var sourceContent = source.Content;
@@ -113,7 +108,7 @@ namespace Timeline.Models.Http }
else
{
- throw new InvalidOperationException("Unknown content type.");
+ throw new InvalidOperationException(Resources.Models.Http.Exception.UnknownPostContentType);
}
}
}
|