awslabs / llrt

LLRT (Low Latency Runtime) is an experimental, lightweight JavaScript runtime designed to address the growing demand for fast and efficient Serverless applications.
Apache License 2.0
7.74k stars 342 forks source link

feat: Implement DOMException() #329

Closed nabetti1720 closed 2 months ago

nabetti1720 commented 2 months ago

Issue # (if available)

Fixes #330

Description of changes

The Minimum Common Web Platform API is being considered at WinterCG. This PR provides DOMException(), which is not yet implemented in llrt.

The unit test with javascript seems to be working well, but we have not yet implemented the return of exceptions from rust to javascript.

events.rs:

let abort_exception = Exception::from_value("AbortError".into_js(&ctx)?)?; // TODO: AbortError DOMException
let timeout_exception = Exception::from_value("TimeoutError".into_js(&ctx)?)?; // TODO: Timeout DOMException

What implementation is needed to eliminate this problem? Any reference to implementations or sample code in already existing projects would be helpful.

Checklist

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.