@@ -74,12 +74,12 @@ public async Task Process(CancellationToken cancellationToken)
7474 if ( maybeExistingComment . HasValue )
7575 {
7676 var result = await _commentBrowser . EditComment ( CommentThing . CreateFromShortId ( maybeExistingComment . Value ) , message ) ;
77- await TryDistinguishStickyAndLockLogFailure ( result . CommentId ) ;
77+ await TryDistinguishStickyAndLockLogFailure ( result . ParentId , result . CommentId ) ;
7878 }
7979 else
8080 {
8181 var result = await _commentBrowser . SubmitComment ( LinkThing . CreateFromShortId ( item . RedditPostId ) , message ) ;
82- await TryDistinguishStickyAndLockLogFailure ( result . CommentId ) ;
82+ await TryDistinguishStickyAndLockLogFailure ( result . ParentId , result . CommentId ) ;
8383
8484#pragma warning disable IDISP001
8585 var innerTx = await lazyTx . GetOrCreateTx ( cancellationToken ) ;
@@ -138,7 +138,7 @@ static async IAsyncEnumerable<string> BuildSection(string heading, string prefix
138138 }
139139 }
140140
141- private async Task TryDistinguishStickyAndLockLogFailure ( CommentThing comment )
141+ private async Task TryDistinguishStickyAndLockLogFailure ( OneOf < LinkThing , CommentThing > parent , CommentThing comment )
142142 {
143143 try
144144 {
@@ -147,7 +147,13 @@ private async Task TryDistinguishStickyAndLockLogFailure(CommentThing comment)
147147 }
148148 catch ( Exception ex )
149149 {
150- _logger . LogError ( ex , "An error occurred while trying to distinguish and sticky comment: {CommentId}" , comment . FullId ) ;
150+ var ( parentType , parentId ) = parent . Map (
151+ static link => ( "link" , link . FullId ) ,
152+ static comment => ( "comment" , comment . FullId ) ) ;
153+
154+ _logger . LogError ( ex ,
155+ "An error occurred while trying to distinguish and sticky comment (ParentType={ParentType}, ParentId={ParentId}, CommentId={CommentId})" ,
156+ parentType , parentId , comment . FullId ) ;
151157 }
152158 }
153159}
0 commit comments