github.com/MontFerret/ferret@v0.18.0/pkg/drivers/cdp/eval/helpers.go (about)

     1  package eval
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/mafredri/cdp/protocol/runtime"
     7  
     8  	"github.com/MontFerret/ferret/pkg/drivers"
     9  	"github.com/MontFerret/ferret/pkg/runtime/core"
    10  )
    11  
    12  func parseRuntimeException(details *runtime.ExceptionDetails) error {
    13  	if details == nil || details.Exception == nil {
    14  		return nil
    15  	}
    16  
    17  	desc := *details.Exception.Description
    18  
    19  	if strings.Contains(desc, drivers.ErrNotFound.Error()) {
    20  		return drivers.ErrNotFound
    21  	}
    22  
    23  	return core.Error(
    24  		core.ErrUnexpected,
    25  		desc,
    26  	)
    27  }