Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

safeMarshal should escape the error message #327

Merged
merged 3 commits into from Oct 3, 2020

Conversation

shogo82148
Copy link
Contributor

Issue #, if available:

the safeMarshal function might return invalid JSON if err.Error() contains special characters of JSON. ref #326

func safeMarshal(v interface{}) []byte {
payload, err := json.Marshal(v)
if err != nil {
return []byte(fmt.Sprintf(serializationErrorFormat, err.Error()))
}
return payload
}

Description of changes:

use json.Marshal instead of fmt.Sprintf.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2020

Codecov Report

Merging #327 into master will increase coverage by 0.22%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #327      +/-   ##
==========================================
+ Coverage   72.23%   72.46%   +0.22%     
==========================================
  Files          18       18              
  Lines         724      730       +6     
==========================================
+ Hits          523      529       +6     
  Misses        136      136              
  Partials       65       65              
Impacted Files Coverage Δ
lambda/invoke_loop.go 75.00% <71.42%> (+3.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 406b8fc...403136f. Read the comment docs.

@bmoffatt bmoffatt merged commit d520080 into aws:master Oct 3, 2020
@shogo82148 shogo82148 deleted the fix-serialize-error-2nd-try branch October 28, 2020 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants