Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return error position for errors returned by oxc_transform_napi #7261

Open
sapphi-red opened this issue Nov 13, 2024 · 0 comments
Open

Return error position for errors returned by oxc_transform_napi #7261

sapphi-red opened this issue Nov 13, 2024 · 0 comments
Assignees
Labels
C-enhancement Category - New feature or request

Comments

@sapphi-red
Copy link
Contributor

errors: wrap_diagnostics(source_path, source_type, &source_text, errors),

This line returns string[], but I'd like to get the value where the error happened. The error message contains that information, but that requires parsing the error message.

If the error returns Error[] (Error is either of the following), I can achieve that without manual parsing.

type Error = {
  // message without frame
  message: string,
  frame?: string,
  pos?: number
  info?: string // if the `help: *` message should be shown after the frame
}
type Error = {
  // message without frame
  message: string,
  frame?: string,
  loc?: { line: number, column: number }
  info?: string // if the `help: *` message should be shown after the frame
}

I used the position to generate the frame on my side (so that the frame is same).

@sapphi-red sapphi-red added the C-enhancement Category - New feature or request label Nov 13, 2024
@Boshen Boshen self-assigned this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category - New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants