Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
ts 20 lines 506 Bytes
Raw
1 import { sourceFileWithMapPointerRegex } from 'effect-errors/logic/stack';
2
3 export interface ErrorLocation {
4 filePath: string;
5 line: number;
6 column: number;
7 }
8
9 export const getErrorLocationFrom = (sourceFile: string): ErrorLocation | undefined => {
10 const regex = sourceFileWithMapPointerRegex.exec(sourceFile);
11 if (regex === null || regex.length !== 7) {
12 return;
13 }
14
15 const filePath = regex[2];
16 const line = +regex[5];
17 const column = +regex[6];
18
19 return { filePath, line, column };
20 };