bolshakov / stoplight

:traffic_light: Traffic control for code.
http://bolshakov.github.io/stoplight/
MIT License
384 stars 40 forks source link

Restoring failures from JSON fails with custom initializers #43

Closed tfausak closed 10 years ago

tfausak commented 10 years ago

This is similar to #42.

>> class CustomError < StandardError
..   def initialize(message, something_else)
..     super(message)
..     end
..   end
=> nil
>> json = Stoplight::Failure.new(CustomError.new('custom message', 'whatever')).to_json
=> "{\"error\":\"#<CustomError: custom message>\",\"time\":\"2014-09-12 11:46:56 -0500\"}"
>> Stoplight::Failure.from_json(json)
ArgumentError: wrong number of arguments (1 for 2)