Problem
The TypeScript parser does not extract exception classname metadata, resulting in incomplete error tracking data.
File Location
src/main/java/io/err0/client/languages/TypescriptSourceCodeParse.java:329
// TODO: extract exception classname meta data
Context
TypeScript has try-catch blocks similar to JavaScript but with type information:
// Standard Error
throw new Error("message");
// Custom error classes
class MyCustomError extends Error {
constructor(message: string) {
super(message);
}
}
throw new MyCustomError("custom error");
// Try-catch
try {
doSomething();
} catch (error: MyCustomError) {
// Handle specific error type
}
Expected Behavior
Extract and store:
- Error class names from
throw statements
- Error types from catch clauses
- Custom error class definitions
- Standard Error subclasses
Implementation Guidance
-
Identify TypeScript error patterns:
throw new ErrorType() statements
catch (error: ErrorType) clauses
- Error class definitions extending Error
- Type annotations on error objects
-
Extract error type information:
- For
throw new X(): extract "X"
- For
catch (e: X): extract "X"
- For class definitions: extract class name if extends Error
-
Store in token metadata
-
Handle TypeScript-specific syntax:
- Type annotations
- Generic error types
- Union types in catch clauses
Test Cases Needed
Add to src/test/testdata/ for TypeScript:
- Throw with Error class
- Throw with custom error
- Catch with type annotation
- Custom error class definition
Reference Files
src/main/java/io/err0/client/languages/JavascriptSourceCodeParse.java (base implementation)
src/main/java/io/err0/client/languages/JavaSourceCodeParse.java (exception handling pattern)
Acceptance Criteria
Problem
The TypeScript parser does not extract exception classname metadata, resulting in incomplete error tracking data.
File Location
src/main/java/io/err0/client/languages/TypescriptSourceCodeParse.java:329// TODO: extract exception classname meta dataContext
TypeScript has try-catch blocks similar to JavaScript but with type information:
Expected Behavior
Extract and store:
throwstatementsImplementation Guidance
Identify TypeScript error patterns:
throw new ErrorType()statementscatch (error: ErrorType)clausesExtract error type information:
throw new X(): extract "X"catch (e: X): extract "X"Store in token metadata
Handle TypeScript-specific syntax:
Test Cases Needed
Add to
src/test/testdata/for TypeScript:Reference Files
src/main/java/io/err0/client/languages/JavascriptSourceCodeParse.java(base implementation)src/main/java/io/err0/client/languages/JavaSourceCodeParse.java(exception handling pattern)Acceptance Criteria