Skip to content

Commit

Permalink
fix unchecked returns
Browse files Browse the repository at this point in the history
  • Loading branch information
didil committed Jun 28, 2024
1 parent cc8c462 commit 73c89ea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/services/message_transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,19 @@ func (mt *messageTransformer) runJavascriptTransform(payload []byte, headers htt
vm.Interrupt("halt")
})

vm.Set("bodyStr", string(payload))
err := vm.Set("bodyStr", string(payload))
if err != nil {
return nil, nil, fmt.Errorf("failed to set bodyStr: %w", err)
}

headersStr, err := json.Marshal(headers)
if err != nil {
return nil, nil, fmt.Errorf("failed to marshal headers to JSON: %w", err)
}
vm.Set("headersStr", string(headersStr))
err = vm.Set("headersStr", string(headersStr))
if err != nil {
return nil, nil, fmt.Errorf("failed to set headersStr: %w", err)
}

// Prepare the full script
fullScript := fmt.Sprintf(`
Expand Down

0 comments on commit 73c89ea

Please sign in to comment.