@@ -41,22 +41,23 @@ export class MediaStore {
4141 const results = await this . database . find ( options || { selector : { } } )
4242 return results . docs
4343 } catch ( error ) {
44- this . log . error ( new BError ( 'all' , error ) )
44+ this . log . error ( new BError ( 'all' , error ) , error )
4545 console . log ( error )
4646 return [ ]
4747 }
4848 }
4949
5050 document ( doc : Partial < MediaInfo > ) : MediaInfo {
51- return { ...doc , _id : this . cleanid ( doc . filename ! ) } as MediaInfo
51+ const document : MediaInfo = { ...doc , _id : this . cleanid ( doc . filename ! ) } as MediaInfo
52+ return document
5253 }
5354
5455 async exists ( id : string ) {
5556 try {
5657 const document = await this . database . get < MediaInfo > ( id )
5758 return document . _id === this . cleanid ( id )
5859 } catch ( error ) {
59- this . log . error ( new BError ( 'exists' , error ) )
60+ this . log . error ( new BError ( 'exists' , error ) , error )
6061 return false
6162 }
6263 }
@@ -65,7 +66,7 @@ export class MediaStore {
6566 try {
6667 return await this . database . get < MediaInfo > ( this . cleanid ( id ) )
6768 } catch ( error ) {
68- this . log . error ( new BError ( 'get' , error ) )
69+ this . log . error ( new BError ( 'get' , error ) , error )
6970 return null
7071 }
7172 }
@@ -82,7 +83,7 @@ export class MediaStore {
8283 try {
8384 return await this . upsert ( this . cleanid ( id ) , { source, ...{ locked : true , host : os . hostname ( ) } } )
8485 } catch ( error ) {
85- this . log . error ( new BError ( 'lock' , error ) )
86+ this . log . error ( new BError ( 'lock' , error ) , error )
8687 }
8788 }
8889
@@ -91,7 +92,7 @@ export class MediaStore {
9192 const document = await this . database . get < MediaInfo > ( this . cleanid ( id ) )
9293 return document . locked === true && document . host !== os . hostname ( )
9394 } catch ( error ) {
94- this . log . error ( new BError ( 'locked' , error ) )
95+ this . log . error ( new BError ( 'locked' , error ) , error )
9596 return false
9697 }
9798 }
@@ -101,7 +102,7 @@ export class MediaStore {
101102 this . log . trace ( 'unlocked' , this . cleanid ( id ) )
102103 return await this . upsert ( this . cleanid ( id ) , { source, ...{ locked : false , host : null } } )
103104 } catch ( error ) {
104- this . log . error ( new BError ( 'unlock' , error ) )
105+ this . log . error ( new BError ( 'unlock' , error ) , error )
105106 }
106107 }
107108
0 commit comments