Finalize inbox artifacts and error protocol
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
package inbox
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"ai-workflow-skill/internal/protocol"
|
||||
)
|
||||
|
||||
func resolveBodyValue(body, bodyFile string) (string, error) {
|
||||
if body != "" && bodyFile != "" {
|
||||
return "", fmt.Errorf("body and body-file are mutually exclusive")
|
||||
return "", protocol.InvalidInput("body and body-file are mutually exclusive", nil)
|
||||
}
|
||||
if bodyFile == "" {
|
||||
return body, nil
|
||||
@@ -15,7 +16,7 @@ func resolveBodyValue(body, bodyFile string) (string, error) {
|
||||
|
||||
content, err := os.ReadFile(bodyFile)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("read body file %q: %w", bodyFile, err)
|
||||
return "", protocol.InvalidInput("failed to read body-file", err)
|
||||
}
|
||||
return string(content), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user