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

Add JSError with tests, add JSObject.description #47

Merged
merged 2 commits into from
Sep 14, 2020
Merged

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Sep 13, 2020

JSError will be used in a future PR with a JSPromise implementation to make a statically typed catch method available on it.

While there's no straightforward way to throw JSError from Swift code right now, I think this type might become useful in some other cases too in the future. Maybe we could find a way to catch an error from an arbitrary JavaScript function?

JSObject and JSError are also CustomStringConvertible, as toString() is available on all JavaScript objects according to the standard.

@MaxDesiatov MaxDesiatov added the enhancement New feature or request label Sep 13, 2020
public var name: String {
ref.name.string!
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although it’s not standard, all engines that I know of implement error.stack to provide a stack trace as a string. It might be useful to access it.

@kateinoigakukun kateinoigakukun merged commit cbbe6f9 into master Sep 14, 2020
@kateinoigakukun kateinoigakukun deleted the jserror branch September 14, 2020 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants