lib/mks/common/methodresponse.rb in mks_common-1.0.8 vs lib/mks/common/methodresponse.rb in mks_common-1.0.9

- old
+ new

@@ -22,9 +22,14 @@ else return MethodResponse.new(true, msg, data.json, nil, nil) end end + def self.error_response(data) + errors = data.is_a?(String) ? data : data.errors + return MethodResponse.new(false,nil, nil, errors, nil) + end + def self.failure_response(data) data.errors.details end end end \ No newline at end of file