From 45e27df7bf3c53b80e53b19f9825c16897e394f0 Mon Sep 17 00:00:00 2001 From: Tristan Menzel Date: Tue, 10 Dec 2024 13:59:26 -0800 Subject: [PATCH] chore: Remove ToDoError class --- src/awst_build/ast-visitors/contract-method-visitor.ts | 4 ++-- src/errors.ts | 1 - src/logger/index.ts | 6 ++---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/awst_build/ast-visitors/contract-method-visitor.ts b/src/awst_build/ast-visitors/contract-method-visitor.ts index 94e7007b..edd17e05 100644 --- a/src/awst_build/ast-visitors/contract-method-visitor.ts +++ b/src/awst_build/ast-visitors/contract-method-visitor.ts @@ -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' @@ -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 }) } } diff --git a/src/errors.ts b/src/errors.ts index f4915653..e5b88eb2 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -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') diff --git a/src/logger/index.ts b/src/logger/index.ts index cb072d4c..67cd7832 100644 --- a/src/logger/index.ts +++ b/src/logger/index.ts @@ -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 } @@ -91,9 +91,7 @@ export const logPuyaExceptions = (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