Skip to content

Commit

Permalink
chore: Remove ToDoError class
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmenzel committed Dec 10, 2024
1 parent df8c162 commit 45e27df
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/awst_build/ast-visitors/contract-method-visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ARC4ABIMethodConfig, ARC4BareMethodConfig, ARC4CreateOption, ContractRe
import * as awst from '../../awst/nodes'
import type { SourceLocation } from '../../awst/source-location'
import { Constants } from '../../constants'
import { CodeError, TodoError } from '../../errors'
import { CodeError } from '../../errors'
import { logger } from '../../logger'
import { codeInvariant, isIn } from '../../util'
import { getArc4StructDef, getFunctionTypes, ptypeToArc4PType } from '../arc4-util'
Expand Down Expand Up @@ -215,6 +215,6 @@ export class ContractMethodVisitor extends ContractMethodBaseVisitor {
memberName: config.name,
}
}
throw new TodoError('Unsupported default argument config')
throw new CodeError('Unsupported default argument config', { sourceLocation: decoratorLocation })
}
}
1 change: 0 additions & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export class CodeError extends PuyaError {
return new CodeError(`Cannot resolve ${sourceType} to ${targetName}`, { sourceLocation })
}
}
export class TodoError extends PuyaError {}
export class InternalError extends PuyaError {
static shouldBeUnreachable() {
return new InternalError('Code should be unreachable')
Expand Down
6 changes: 2 additions & 4 deletions src/logger/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SourceLocation } from '../awst/source-location'
import { AwstBuildFailureError, CodeError, PuyaError, TodoError } from '../errors'
import { AwstBuildFailureError, CodeError, PuyaError } from '../errors'
import type { LogSink } from './sinks'

type NodeOrSourceLocation = SourceLocation | { sourceLocation: SourceLocation }
Expand Down Expand Up @@ -91,9 +91,7 @@ export const logPuyaExceptions = <T>(action: () => T, sourceLocation: SourceLoca
try {
return action()
} catch (e) {
if (e instanceof TodoError) {
logger.warn(e.sourceLocation ?? sourceLocation, `TODO: ${e.message}`)
} else if (e instanceof PuyaError) {
if (e instanceof PuyaError) {
logger.error(e.sourceLocation ?? sourceLocation, e.message)
} else {
throw e
Expand Down

0 comments on commit 45e27df

Please sign in to comment.