Accessing JS error object from MiniRacer::EvalError?
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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rubyjs/mini_racer
-
bug/crash platform: linux/x86
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
rubyjs/mini_racer#422 · 10 commenti ·
-
platform: darwin/x86
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
rubyjs/mini_racer#388 · 4 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
rubyjs/mini_racer#376 ·
-
Load script as moduleAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
rubyjs/mini_racer#353 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
rubyjs/mini_racer#346 · 6 commenti · 1 reazione ·
Tutte le issue di rubyjs/mini_racer
Issue simili
-
bug Frontend P2-medium UI UX
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
Deepak3699/Ai_Mentor#427 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
11ty/buildawesome#4407 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
keyxmakerx/Chronicle#1711 ·
I maintainer di solito rispondono entro 1 giorno
-
frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
uoftblueprint/canada-basketball#79 ·
I maintainer di solito rispondono entro 1 giorno
-
New App Request
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
ThatGuySam/doesitarm#1126 · 1 commento ·