Closed byakuren-hijiri closed 3 months ago
This is definitely where we are going to. There is on detail, though. We should provide more info and not just throw TactCompilationError
but differentiate between error kinds: parse errors, type errors, etc.
Tact compiler throws exceptions when compilation errors occur. Typically, it uses
throwCompilationError
for this.This enables the third-party tools to understand the reason of the exception by inspecting the error stacktrace, e.g.:
The problem is that in some cases we use
throw new Error
when compilation error occurs. For example, when an unresolved import appears:https://github.com/tact-lang/tact/blob/2524aae05b558deaab3ce01086aefc21d65373c8/src/imports/resolveImports.ts#L50
The idea is to examine all the cases when we
throw
and to replace them withthrowCompilationError
orthrowInternalCompilerError
if possible.This will be helpful for the tooling and will provide a more unified internal API, fostering debugging of Tact.