mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
use errors.New when not formatting
This commit is contained in:
@@ -2,7 +2,7 @@ package processor
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/jwetzell/showbridge-go/internal/config"
|
||||
@@ -17,7 +17,7 @@ func (se *StringSplit) Process(ctx context.Context, payload any) (any, error) {
|
||||
payloadString, ok := payload.(string)
|
||||
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("string.split only accepts a string")
|
||||
return nil, errors.New("string.split only accepts a string")
|
||||
}
|
||||
|
||||
payloadParts := strings.Split(payloadString, se.Separator)
|
||||
@@ -38,13 +38,13 @@ func init() {
|
||||
separator, ok := params["separator"]
|
||||
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("string.split requires a separator")
|
||||
return nil, errors.New("string.split requires a separator")
|
||||
}
|
||||
|
||||
separatorString, ok := separator.(string)
|
||||
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("string.split separator must be a string")
|
||||
return nil, errors.New("string.split separator must be a string")
|
||||
}
|
||||
|
||||
return &StringSplit{config: config, Separator: separatorString}, nil
|
||||
|
||||
Reference in New Issue
Block a user