Browse Source

query node - mappings logging not-implemented situations

ondratra 3 years ago
parent
commit
1f15998dcf

+ 6 - 2
query-node/mappings/src/content/utils.ts

@@ -26,6 +26,7 @@ import {
 
 import {
   inconsistentState,
+  logger,
   prepareDataObject,
 } from '../common'
 
@@ -107,7 +108,8 @@ export async function readProtobuf<T extends ChannelCategory | VideoCategory>(
   }
 
   // this should never happen
-  throw `Not implemented type: ${type}`
+  logger.error('Not implemented metadata type', {type})
+  throw `Not implemented metadata type`
 }
 
 /*
@@ -232,7 +234,8 @@ export async function readProtobufWithAssets<T extends Channel | Video>(
   }
 
   // this should never happen
-  throw `Not implemented type: ${type}`
+  logger.error('Not implemented metadata type', {type})
+  throw `Not implemented metadata type`
 }
 
 export function convertContentActorToOwner(contentActor: ContentActor, channelId: BN): typeof DataObjectOwner {
@@ -256,6 +259,7 @@ export function convertContentActorToOwner(contentActor: ContentActor, channelId
     return owner
   }
 
+  logger.error('Not implemented ContentActor type', {contentActor: contentActor.toString()})
   throw 'Not-implemented ContentActor type used'
   */
 }

+ 2 - 1
query-node/mappings/src/membership.ts

@@ -190,5 +190,6 @@ function convertEntryMethod(entryMethod: EntryMethod): MembershipEntryMethod {
   }
 
   // should never happen
-  throw 'Not-implemented entry method used'
+  logger.error('Not implemented entry method', {entryMethod: entryMethod.toString()})
+  throw 'Not implemented entry method'
 }

+ 2 - 1
query-node/mappings/src/storage.ts

@@ -124,5 +124,6 @@ function convertStorageObjectOwner(objectOwner: StorageObjectOwner): typeof Data
     return owner
   }
 
-  throw 'Not-implemented StorageObjectOwner type used'
+  logger.error('Not implemented StorageObjectOwner type', {objectOwner: objectOwner.toString()})
+  throw 'Not implemented StorageObjectOwner type'
 }