Skip to content

Commit

Permalink
Fix base error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Rey committed Apr 30, 2024
1 parent e82260d commit c377250
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/massa-web3/src/experimental/errors/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ export class ErrorBase extends Error {
cause?: Error

override name = 'MassaWeb3Error'
constructor(shortMessage: string, args: BaseParameters) {
constructor(shortMessage: string, args?: BaseParameters) {
super()

const metaMessageStr =
args.metaMessages?.map((msg) => `Meta: ${msg}`).join('\n') || ''
const docsMessageStr = args.docsPath
? `Docs: see ${args.docsPath} for more information.`
args?.metaMessages?.map((msg) => `Meta: ${msg}`).join('\n') || ''
const docsMessageStr = args?.docsPath
? `Docs: see ${args?.docsPath} for more information.`
: ''

const detailsMessage = args.details ? `Details: ${args.details}` : ''
const detailsMessage = args?.details ? `Details: ${args.details}` : ''

this.message = [
shortMessage,
Expand All @@ -46,9 +46,9 @@ export class ErrorBase extends Error {
.filter(Boolean)
.join('\n\n')

this.metaMessages = args.metaMessages || []
this.docsPath = args.docsPath
this.code = args.code ?? ErrorCodes.UnknownError
this.cause = args.cause
this.metaMessages = args?.metaMessages || []
this.docsPath = args?.docsPath
this.code = args?.code ?? ErrorCodes.UnknownError
this.cause = args?.cause
}
}

0 comments on commit c377250

Please sign in to comment.