Use warning log level for skipped entities

This commit is contained in:
Henrik Hüttemann 2023-09-13 16:42:14 +02:00
parent 29036deb58
commit 4fb240b39a
No known key found for this signature in database
GPG Key ID: 9F7BD10E0A8A111E
3 changed files with 16 additions and 6 deletions

View File

@ -161,7 +161,7 @@ export async function handle(rcMessage: RcMessage): Promise<void> {
case 'added-user-to-team': // Added user to team case 'added-user-to-team': // Added user to team
case 'r': // Room name changed case 'r': // Room name changed
case 'rm': // Message removed case 'rm': // Message removed
log.info( log.warn(
`Message ${rcMessage._id} is of type ${rcMessage.t}, for which Rocket.Chat does not provide the initial state information, skipping.` `Message ${rcMessage._id} is of type ${rcMessage.t}, for which Rocket.Chat does not provide the initial state information, skipping.`
) )
return return

View File

@ -106,7 +106,9 @@ test('mapping private rooms', () => {
test('mapping live chats', () => { test('mapping live chats', () => {
expect(() => expect(() =>
mapRoom({ _id: 'liveChatId', t: RcRoomTypes.live }) mapRoom({ _id: 'liveChatId', t: RcRoomTypes.live })
).toThrowError('Room type l is unknown') ).toThrowError(
'Room with ID: liveChatId is a live chat. Migration not implemented'
)
}) })
test('getting creator', () => { test('getting creator', () => {

View File

@ -83,10 +83,18 @@ export function mapRoom(rcRoom: RcRoom): MatrixRoom {
break break
case RcRoomTypes.live: case RcRoomTypes.live:
const messageLivechat = `Room ${
rcRoom.name || 'with ID: ' + rcRoom._id
} is a live chat. Migration not implemented`
log.warn(messageLivechat)
throw new Error(messageLivechat)
default: default:
const message = `Room type ${rcRoom.t} is unknown or unimplemented` const messageUnknownRoom = `Room ${
log.error(message) rcRoom.name || 'with ID: ' + rcRoom._id
throw new Error(message) } is of type ${rcRoom.t}, which is unknown or unimplemented`
log.error(messageUnknownRoom)
throw new Error(messageUnknownRoom)
} }
return room return room
} }
@ -98,7 +106,7 @@ export function getCreator(rcRoom: RcRoom): string {
return rcRoom.uids[0] return rcRoom.uids[0]
} else { } else {
log.warn( log.warn(
`Creator ID could not be determined for room ${rcRoom.name} of type ${rcRoom.t}. This is normal for the default room.` `Creator ID could not be determined for room ${rcRoom.name} of type ${rcRoom.t}. This is normal for the default room. Using admin user.`
) )
return '' return ''
} }