Skip to content

Commit

Permalink
Improve logging robustness
Browse files Browse the repository at this point in the history
Do not pretty print a JSON object when serialization or serialization fail, for details see pact-foundation#103.
  • Loading branch information
lextiz committed Mar 26, 2019
1 parent 8d1de21 commit 037cc88
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/pact/mock_service/request_handlers/interaction_replay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ module RequestHandlers
module PrettyGenerate
#Doesn't seem to reliably pretty generate unless we go to JSON and back again :(
def pretty_generate object
JSON.pretty_generate(JSON.parse(object.to_json))
begin
JSON.pretty_generate(JSON.parse(object.to_json))
rescue JSON::ParserError
object
end
end
end

Expand Down

0 comments on commit 037cc88

Please sign in to comment.