Finalize inbox artifacts and error protocol
This commit is contained in:
@@ -18,6 +18,7 @@ type updateOptions struct {
|
||||
body string
|
||||
bodyFile string
|
||||
payloadJSON string
|
||||
artifacts artifactOptions
|
||||
}
|
||||
|
||||
func newUpdateCmd(root *rootOptions) *cobra.Command {
|
||||
@@ -34,13 +35,17 @@ func newUpdateCmd(root *rootOptions) *cobra.Command {
|
||||
agent = root.agent
|
||||
}
|
||||
if agent == "" {
|
||||
return fmt.Errorf("agent is required")
|
||||
return protocol.InvalidInput("agent is required", nil)
|
||||
}
|
||||
|
||||
body, err := resolveBodyValue(opts.body, opts.bodyFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
artifacts, err := resolveArtifacts(opts.artifacts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sqlDB, err := db.Open(ctx, root.dbPath)
|
||||
if err != nil {
|
||||
@@ -56,6 +61,7 @@ func newUpdateCmd(root *rootOptions) *cobra.Command {
|
||||
Summary: opts.summary,
|
||||
Body: body,
|
||||
PayloadJSON: opts.payloadJSON,
|
||||
Artifacts: artifacts,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -86,6 +92,7 @@ func newUpdateCmd(root *rootOptions) *cobra.Command {
|
||||
cmd.Flags().StringVar(&opts.body, "body", "", "Update body")
|
||||
cmd.Flags().StringVar(&opts.bodyFile, "body-file", "", "Read update body from file")
|
||||
cmd.Flags().StringVar(&opts.payloadJSON, "payload-json", "", "Structured payload JSON string")
|
||||
addArtifactFlags(cmd, &opts.artifacts)
|
||||
|
||||
_ = cmd.MarkFlagRequired("thread")
|
||||
_ = cmd.MarkFlagRequired("status")
|
||||
|
||||
Reference in New Issue
Block a user