Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Accessing JS error object from MiniRacer::EvalError?

Đang mở
#129 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, ruby
Lĩnh vực
backend

Hướng nghiên cứu

Start by reading the MiniRacer::EvalError and MiniRacer::Context#eval implementation, then inspect the tests for evaluation errors and backtraces. Determine whether the JavaScript error object and its custom attributes can be exposed while preserving source line numbers; done means the issue's use case works without wrapper-induced backtrace offsets. The discussion has had no recent activity, so check its thread before starting.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I'm wondering how I can access the JavaScript error object from MiniRacer::EvalError.

I want to run script snippets from users and I want to report errors to them. We have some extended attributes on custom errors which I would need to access.

The only way I found to solve this is by wrapping the script before sending it to MiniRacer::Context#eval like this:

wrapper = <<~JS
  try {
#{script}
  }
  catch(err) {
    var thrownError = err;
  }
JS

context.eval(wrapper)

With this I can access thrownError. But my issue is, that line numbers in backtraces are off. My current solution is to have a map that contains offsets accounting for the wrapper script.

Is there any other way to achieve this?

Ngôn ngữ chính
JavaScript
Star
628
Fork
100
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rubyjs/mini_racer

Tất cả issue của rubyjs/mini_racer

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.