Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/raven/okjson.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def valenc(x)
when false then "false"
when nil then "null"
else
raise Error, "cannot encode #{x.class}: #{x.inspect}"
strenc((x.inspect rescue $!.to_s))
end
end

Expand Down
7 changes: 7 additions & 0 deletions spec/raven/okjson_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
end
end

it 'encodes anything that responds to to_s' do
data = [
(1..5)
]
expect(Raven::OkJson.encode(data)).to eq '["1..5"]'
end

it 'parses zero-leading exponent numbers correctly' do
expect(Raven::OkJson.decode("[123e090]")).to eq [123000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
end
Expand Down