Skip to content

Commit

Permalink
logging the error is noisy for the users
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmgdr committed Mar 28, 2024
1 parent e90a7f8 commit 019fc4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"lint": "yarn run --top-level eslint -c .eslintrc.js ",
"prepublish": "",
"prepack": "yarn run build && oclif manifest && oclif readme",
"test": "yarn jest --runInBand --detectOpenHandles"
"test": "yarn jest --runInBand --silent --detectOpenHandles"
},
"dependencies": {
"@celo/abis": "11.0.0",
Expand Down
10 changes: 7 additions & 3 deletions packages/cli/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import { LocalWallet } from '@celo/wallet-local'
import _TransportNodeHid from '@ledgerhq/hw-transport-node-hid'
import { Command, Flags } from '@oclif/core'
import chalk from 'chalk'
import debugFactory from 'debug'
import net from 'net'
import Web3 from 'web3'
import { CustomFlags } from './utils/command'
import { getNodeUrl } from './utils/config'
import { requireNodeIsSynced } from './utils/helpers'

const debug = debugFactory('cli:base')

export abstract class BaseCommand extends Command {
static flags = {
privateKey: Flags.string({
Expand Down Expand Up @@ -232,10 +235,11 @@ export abstract class BaseCommand extends Command {
async finally(arg: Error | undefined): Promise<any> {
try {
if (arg) {
console.error('received error while cleaning up', arg)
debug('received error while cleaning up:', arg)
}
const kit = await this.getKit()
kit.connection.stop()
// we only need to stop the kit if one exists. if there is an error on this.parse for flags then there is no kit and thus none to stop
// if we use this.getKit then this.parse is called and errors out. throwing and logging failed to close the connection
this._kit && this._kit.connection.stop()
} catch (error) {
this.log(`Failed to close the connection: ${error}`)
}
Expand Down

0 comments on commit 019fc4b

Please sign in to comment.