MCPcopy Create free account
hub / github.com/brimdata/super / convertError

Method convertError

sup/analyzer.go:564–584  ·  view source on GitHub ↗
(sctx *super.Context, val *ast.Error, cast super.Type)

Source from the content-addressed store, hash-verified

562}
563
564func (a Analyzer) convertError(sctx *super.Context, val *ast.Error, cast super.Type) (Value, error) {
565 var inner super.Type
566 if cast != nil {
567 typ, ok := super.TypeUnder(cast).(*super.TypeError)
568 if !ok {
569 return nil, errors.New("error decorator not of type error")
570 }
571 inner = typ.Type
572 }
573 under, err := a.convertValue(sctx, val.Value, inner)
574 if err != nil {
575 return nil, err
576 }
577 if cast == nil {
578 cast = sctx.LookupTypeError(under.TypeOf())
579 }
580 return &Error{
581 Value: under,
582 Type: cast,
583 }, nil
584}
585
586func (a Analyzer) convertFusion(sctx *super.Context, val *ast.Fusion, cast super.Type) (Value, error) {
587 var inner super.Type

Callers 1

convertAnyMethod · 0.95

Calls 5

convertValueMethod · 0.95
TypeUnderFunction · 0.92
NewMethod · 0.80
LookupTypeErrorMethod · 0.80
TypeOfMethod · 0.65

Tested by

no test coverage detected