Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: If error include logMessage field, ignore message to log #3223

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/neuron-wallet/src/controllers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,10 @@ export default class ApiController {
// All objects, array, class instance need to be serialized before sent to the IPC
return typeof res === 'object' ? JSON.parse(JSON.stringify(res)) : res
} catch (err) {
logger.warn(`API Controller:\tchannel handling error: ${err}`, err.stack)
logger.warn(
`API Controller:\tchannel handling error: ${err.logMessage ?? err}`,
!err.logMessage ? err.stack : undefined
)

if (err.code === 'ECONNREFUSED') {
const NODE_DISCONNECTED_CODE = 104
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-wallet/src/exceptions/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class WalletFunctionNotSupported extends Error {

export class DuplicateImportWallet extends Error {
public code = 118
public logMessage = 'Duplicate import wallet'
constructor(errorStr: string) {
super(errorStr)
}
Expand Down