Use if-flows instead of rescue-flows

This commit is contained in:
gregoirenovel 2018-03-15 14:41:04 +01:00
parent 182afee970
commit 19add3f534
4 changed files with 31 additions and 23 deletions

View file

@ -11,11 +11,13 @@ class ApiEntreprise::EntrepriseAdapter
end
def to_params
params = data_source[:entreprise].slice(*attr_to_fetch)
params[:date_creation] = Time.at(params[:date_creation]).to_datetime
params
rescue
nil
if data_source.present?
params = data_source[:entreprise].slice(*attr_to_fetch)
params[:date_creation] = Time.at(params[:date_creation]).to_datetime
params
else
nil
end
end
private