@@ -96,6 +96,26 @@ export class ClaimController {
9696 } ,
9797 )
9898
99+ const publishEntryFailureReason = async (
100+ ipfsFileHash : string ,
101+ failureType : FailureType ,
102+ failureReason : FailureReason ,
103+ failureTime : number
104+ ) => {
105+ const logger = this . logger . child ( { method : 'publishEntryFailureReason' } )
106+ logger . trace ( 'started publishing' )
107+
108+ await this . messaging . publishClaimsNotDownloaded ( [
109+ {
110+ ipfsFileHash,
111+ failureType,
112+ failureReason,
113+ failureTime,
114+ } ,
115+ ] )
116+ logger . trace ( 'finished publishing' )
117+ }
118+
99119 const pipe = pipeP (
100120 this . findEntryToDownload ,
101121 this . updateEntryAttempts ,
@@ -107,13 +127,26 @@ export class ClaimController {
107127
108128 const handleErrors = async ( error : Error ) => {
109129 if ( error instanceof NoMoreEntriesException ) logger . trace ( error . message )
110- else if ( error instanceof InvalidClaim )
130+ else if ( error instanceof InvalidClaim ) {
111131 await updateEntryFailureReason ( error . ipfsFileHash , FailureType . Hard , error . failureReason )
112- else if ( error instanceof IPFSTimeoutError )
132+ await publishEntryFailureReason ( error . ipfsFileHash , FailureType . Hard , error . failureReason , error . failureTime )
133+ } else if ( error instanceof IPFSTimeoutError ) {
113134 await updateEntryFailureReason ( error . ipfsFileHash , FailureType . Soft , FailureReason . IPFSTimeout )
114- else if ( error instanceof IPFSGenericError ) {
135+ await publishEntryFailureReason (
136+ error . ipfsFileHash ,
137+ FailureType . Soft ,
138+ FailureReason . IPFSTimeout ,
139+ error . failureTime
140+ )
141+ } else if ( error instanceof IPFSGenericError ) {
115142 logger . warn ( { error } )
116143 await updateEntryFailureReason ( error . ipfsFileHash , FailureType . Soft , FailureReason . IPFSGeneric )
144+ await publishEntryFailureReason (
145+ error . ipfsFileHash ,
146+ FailureType . Soft ,
147+ FailureReason . IPFSGeneric ,
148+ error . failureTime
149+ )
117150 } else throw error
118151 }
119152
0 commit comments