Commit fa4898aa authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

fix: logging error messages and stack (#843)

* batch-submitter: log error explicitly

* data-transport-layer: log error explicitly

* message-relayer: log error explicitly

* chore: add changeset
parent a30817e5
---
'@eth-optimism/batch-submitter': patch
'@eth-optimism/data-transport-layer': patch
'@eth-optimism/message-relayer': patch
---
Explicitly log error messages so that they do not show as empty objects
...@@ -286,7 +286,11 @@ export const run = async () => { ...@@ -286,7 +286,11 @@ export const run = async () => {
} }
} }
} catch (err) { } catch (err) {
logger.error('Cannot clear transactions', { err }) logger.error('Cannot clear transactions', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
process.exit(1) process.exit(1)
} }
} }
...@@ -295,7 +299,11 @@ export const run = async () => { ...@@ -295,7 +299,11 @@ export const run = async () => {
try { try {
await func() await func()
} catch (err) { } catch (err) {
logger.error('Error submitting batch', { err }) logger.error('Error submitting batch', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
logger.info('Retrying...') logger.info('Retrying...')
} }
// Sleep // Sleep
......
...@@ -115,10 +115,13 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> { ...@@ -115,10 +115,13 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {
} }
} catch (err) { } catch (err) {
if (!this.running || this.options.dangerouslyCatchAllErrors) { if (!this.running || this.options.dangerouslyCatchAllErrors) {
this.logger.error('Caught an unhandled error', { err }) this.logger.error('Caught an unhandled error', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
await sleep(this.options.pollingInterval) await sleep(this.options.pollingInterval)
} else { } else {
// TODO: Is this the best thing to do here?
throw err throw err
} }
} }
......
...@@ -243,7 +243,11 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> { ...@@ -243,7 +243,11 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
} }
) )
} catch (err) { } catch (err) {
this.logger.error('Caught an unhandled error', { err }) this.logger.error('Caught an unhandled error', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
} }
} }
} }
...@@ -490,7 +494,11 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> { ...@@ -490,7 +494,11 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
'Proof should succeed. Submitting for real this time...' 'Proof should succeed. Submitting for real this time...'
) )
} catch (err) { } catch (err) {
this.logger.error('Proof would fail, skipping', { err }) this.logger.error('Proof would fail, skipping', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
return return
} }
...@@ -522,7 +530,11 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> { ...@@ -522,7 +530,11 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
status: receipt.status, status: receipt.status,
}) })
} catch (err) { } catch (err) {
this.logger.error('Real relay attempt failed, skipping.', { err }) this.logger.error('Real relay attempt failed, skipping.', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
return return
} }
this.logger.info('Message successfully relayed to Layer 1!') this.logger.info('Message successfully relayed to Layer 1!')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment