Merge pull request #888 from trheyi/main
Add optional options handling in objectCall.run method
This commit is contained in:
commit
7164eddaba
1 changed files with 6 additions and 3 deletions
|
|
@ -202,11 +202,14 @@ func (obj *objectCall) run(info *v8go.FunctionCallbackInfo) *v8go.Value {
|
||||||
return bridge.JsException(info.Context(), fmt.Sprintf("Failed to get the options: %s", err.Error()))
|
return bridge.JsException(info.Context(), fmt.Sprintf("Failed to get the options: %s", err.Error()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the options is undefined
|
||||||
|
if !jsOptions.IsUndefined() {
|
||||||
err = bridge.Unmarshal(jsOptions, &options)
|
err = bridge.Unmarshal(jsOptions, &options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return bridge.JsException(info.Context(), fmt.Sprintf("Failed to unmarshal the options: %s", err.Error()))
|
return bridge.JsException(info.Context(), fmt.Sprintf("Failed to unmarshal the options: %s", err.Error()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get the assistant
|
// Get the assistant
|
||||||
newAst, err := Get(assistantID)
|
newAst, err := Get(assistantID)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue