Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Accessing JS error object from MiniRacer::EvalError?

Aperta
#129 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, ruby
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?

Lingua principale
JavaScript
Stelle
628
Fork
100
Merge medio
1g 20h
PR unite (30g)
2

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rubyjs/mini_racer

Tutte le issue di rubyjs/mini_racer

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.