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

Refactor parseConsoleRemoteObject to return error #1166

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

ankur22
Copy link
Collaborator

@ankur22 ankur22 commented Jan 19, 2024

What?

Returning an error from parseConsoleRemoteObject instead of logging an error.

Why?

There is another use case for parseConsoleRemoteObject, which is when JSONValue is called. At the moment this API uses valueFromRemoteObject which returns a goja.Value.

Interestingly, the return value from JSONValue is always converted to string before being returned to the caller, so the extra step to convert to goja and then back to string is not needed.

Checklist

  • I have performed a self-review of my code
  • I have added tests for my changes
  • I have commented on my code, particularly in hard-to-understand areas

Related PR(s)/Issue(s)

Updates: #1168

@ankur22 ankur22 marked this pull request as draft January 19, 2024 13:20
@ankur22 ankur22 force-pushed the refactor/parseConsoleRemoteObject branch from 868b1bc to 7302c41 Compare January 19, 2024 13:37
@ankur22 ankur22 changed the base branch from main to main-next January 19, 2024 14:25
@ankur22 ankur22 force-pushed the refactor/parseConsoleRemoteObject branch 2 times, most recently from 3d38886 to 8d48cf6 Compare January 24, 2024 12:36
@ankur22 ankur22 marked this pull request as ready for review January 24, 2024 12:36
@ankur22 ankur22 force-pushed the refactor/parseConsoleRemoteObject branch from 8d48cf6 to fc47e2e Compare January 25, 2024 16:01
common/remote_object.go Outdated Show resolved Hide resolved
inancgumus
inancgumus previously approved these changes Jan 29, 2024
@ankur22 ankur22 changed the base branch from main-next to main January 29, 2024 10:50
@ankur22 ankur22 dismissed inancgumus’s stale review January 29, 2024 10:50

The base branch was changed.

There is another use case for parseConsoleRemoteObject, which is when
JSONValue is called. At the moment this API uses valueFromRemoteObject
which returns a goja.Value. Interestingly, the return value is always
converted to string before being returned to the caller, so the extra
step to convert to goja and then back to string is not needed.
@ankur22 ankur22 force-pushed the refactor/parseConsoleRemoteObject branch from b0f41e7 to 5aedac1 Compare January 29, 2024 10:53
@ankur22 ankur22 merged commit e99929c into main Jan 29, 2024
17 checks passed
@ankur22 ankur22 deleted the refactor/parseConsoleRemoteObject branch January 29, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants