Skip to content

Commit

Permalink
fix(repo): typing errors due to unknow error type (#213)
Browse files Browse the repository at this point in the history
* fix

* more fixes
  • Loading branch information
samuelmasse authored Oct 19, 2021
1 parent b92ca08 commit b13114e
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/server/src/channels/vonage/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class VonageChannel extends Channel<VonageConduit> {
decoded.api_key === conduit.config.apiKey &&
crypto.createHash('sha256').update(JSON.stringify(body)).digest('hex') === decoded.payload_hash
)
} catch (err) {
} catch (e) {
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/instances/monitoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class InstanceMonitoring {
await this.loadNonLazyConduits()
})
} catch (e) {
this.logger.error(e, 'Error occurred while monitoring', e.message)
this.logger.error(e, 'Error occurred while monitoring', (e as Error).message)
} finally {
setTimeout(this.tickMonitoring.bind(this), ms('15s'))
}
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/instances/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class InstanceService extends Service {
} catch (e) {
this.cache.del(conduitId)

await this.statusService.addError(conduitId, e)
await this.statusService.addError(conduitId, e as Error)
instance.logger.error(e, 'Error trying to initialize conduit')

return this.emitter.emit(InstanceEvents.InitializationFailed, conduitId)
Expand Down Expand Up @@ -157,7 +157,7 @@ export class InstanceService extends Service {
} catch (e) {
this.cache.del(conduitId)

await this.statusService.addError(conduitId, e)
await this.statusService.addError(conduitId, e as Error)
instance.logger.error(e, 'Error trying to setup conduit')

await this.emitter.emit(InstanceEvents.SetupFailed, conduitId)
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/logger/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ export class Logger {
)
}

error(error: Error | undefined, message?: string, data?: Param) {
error(error: Error | undefined | unknown, message?: string, data?: Param) {
if (message?.length && message[message.length - 1] !== '.') {
message += '.'
}

this.printPrefix([message, data, error?.stack], LoggerLevel.Error)
this.printPrefix([message, data, error instanceof Error ? error.stack : undefined], LoggerLevel.Error)
}

private center(text: string, width: number) {
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/post/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class PostService extends Service {
} catch (e) {
this.logger.warn(
`Unabled to reach webhook after ${this.attempts} attempts ${clc.blackBright(url)} ${clc.blackBright(
`Error: ${e.message}`
`Error: ${(e as Error).message}`
)}`
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/skin/src/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const element = <K extends keyof HTMLElementTagNameMap, N extends Node>(
try {
construct?.(node)
} catch (e) {
node.appendChild(document.createTextNode(e))
node.appendChild(document.createTextNode(<any>e))
}

parent.appendChild(node)
Expand Down

0 comments on commit b13114e

Please sign in to comment.