Skip to content

Commit

Permalink
updated error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed Aug 16, 2024
1 parent f3f8dac commit d9e060f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions service/operator/async.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/viant/structology"
"github.com/viant/toolbox"
"github.com/viant/xdatly/handler/async"
"reflect"
"strings"
"time"
)
Expand Down Expand Up @@ -77,13 +78,13 @@ func (s *Service) updateJobStatusDone(ctx context.Context, aComponent *repositor
return aComponent.Async.UpdateJob(ctx, job)
}

var queryParameter = state.NewParameter("query", state.NewQueryLocation(""))
var queryParameter = state.NewParameter("Query", state.NewQueryLocation(""), state.WithParameterSchema(state.NewSchema(reflect.TypeOf(""))))

func (s *Service) buildJob(ctx context.Context, aSession *session.Session, aState *structology.State, aComponent *repository.Component, matchKey string, options *session.Options) (*async.Job, error) {
asyncModule := aComponent.Async

query := struct {
URI string `parameters:"kind=query"`
URI string `parameter:"kind=query"`
}{}
_ = aSession.Into(ctx, &query)
_ = aSession.SetCacheValue(ctx, queryParameter, query.URI)
Expand Down
7 changes: 5 additions & 2 deletions service/session/stater.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ func (s *Session) Into(ctx context.Context, dest interface{}, opts ...hstate.Opt
s.kindLocator.RemoveLocators(state.KindForm, state.KindRequest, state.KindQuery)
s.kindLocator.RemoveLocators(state.KindComponent)
}
viewOptions := s.ViewOptions(s.view, WithLocatorOptions())
stateOptions := viewOptions.kindLocator.Options()
var stateOptions []locator.Option
if s.view != nil {
viewOptions := s.ViewOptions(s.view, WithLocatorOptions())
stateOptions = viewOptions.kindLocator.Options()
}
options := s.Indirect(true, stateOptions...)
options.scope = hOptions.Scope()
if err = s.SetState(ctx, stateType.Parameters, aState, options); err != nil {
Expand Down

0 comments on commit d9e060f

Please sign in to comment.