-
Notifications
You must be signed in to change notification settings - Fork 22
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
BAAS-26309: Only use json stringify for arrays and objects #114
Conversation
|
||
return val.String() | ||
return e.Error() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning this to align with the usage from baas: https://github.com/10gen/baas/blob/b16c5f867a6f90dead8fa56c723367de7bb8b25b/function/execution/common/errors.go#L73
base := e.val.baseObject(r) | ||
if base != nil { | ||
switch base.ClassName() { | ||
case "Array", "Object": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworked this function a bit to only go through json stringify for types that we will have a harder time with in baas. These should also be exceptional (maybe?) if a user were to do something like this:
throw { foo: "bar" };
// or
throw [1, 2, 3];
Not really sure why they would do that but they could and this should stringify so that we can see that value as the "error" in baas
{ | ||
description: "Array", | ||
exceptionVal: func() Value { | ||
array := runtime.builtin_newArray([]Value{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calvin, I tagged you just because I saw your name around Arrays and objects when I was trying to figure out how to construct stuff. Feel free to remove yourself if you don't think this needs a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The tests look good and I'm not concerned about the impact of changes to StringifyError
since it's specific to our fork and isn't used anywhere yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 🚀 🚀
No description provided.