More info when logging the request

pull/6610/head
Chocobozzz 2024-09-17 08:35:54 +02:00
parent 5ae90e0757
commit a9cb29dfc1
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 9 additions and 3 deletions

View File

@ -14,9 +14,13 @@ const lTags = loggerTagsFactory('request')
export interface PeerTubeRequestError extends Error {
statusCode?: number
responseBody?: any
responseHeaders?: any
requestHeaders?: any
requestUrl?: any
requestMethod?: any
}
export type PeerTubeRequestOptions = {
@ -251,6 +255,8 @@ function buildRequestError (error: RequestError) {
if (error.options) {
newError.requestHeaders = error.options.headers
newError.requestUrl = error.options.url
newError.requestMethod = error.options.method
}
return newError

View File

@ -38,7 +38,7 @@ async function createAccountPlaylists (playlistUrls: string[]) {
return createOrUpdateVideoPlaylist(playlistObject)
} catch (err) {
logger.warn('Cannot add playlist element %s.', playlistUrl, { err, ...lTags(playlistUrl) })
logger.warn('Cannot add playlist element ' + playlistUrl, { err, ...lTags(playlistUrl) })
}
}, { concurrency: CRAWL_REQUEST_CONCURRENCY })
}
@ -149,7 +149,7 @@ async function buildElementsDBAttributes (elementUrls: string[], playlist: MVide
elementsToCreate.push(playlistElementObjectToDBAttributes(elementObject, playlist, video))
} catch (err) {
logger.warn('Cannot add playlist element %s.', elementUrl, { err, ...lTags(playlist.uuid, playlist.url) })
logger.warn('Cannot add playlist element ' + elementUrl, { err, ...lTags(playlist.uuid, playlist.url) })
}
}, { concurrency: CRAWL_REQUEST_CONCURRENCY })

View File

@ -29,7 +29,7 @@ async function processDeleteActivity (options: APProcessorOptions<ActivityDelete
const byActorFull = await ActorModel.loadByUrlAndPopulateAccountAndChannel(byActor.url)
if (isAccountActor(byActorFull.type)) {
if (!byActorFull.Account) throw new Error('Actor ' + byActorFull.url + ' is a person but we cannot find it in database.')
if (!byActorFull.Account) throw new Error(`Actor ${byActorFull.url} is a person but we cannot find the account in database.`)
const accountToDelete = byActorFull.Account as MAccountActor
accountToDelete.Actor = byActorFull