Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1527 from cdowding-sl/fix/1072
Browse files Browse the repository at this point in the history
Improved JSON deserialisation exception messages
  • Loading branch information
cdowding-sl authored Nov 8, 2019
2 parents 3f941ce + 151bca7 commit 402c219
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.scottlogic.deg.common.ValidationException;
import com.scottlogic.deg.profile.dtos.ProfileDTO;
import com.scottlogic.deg.profile.reader.FileReader;

import java.io.IOException;
import java.io.UncheckedIOException;

public class ProfileDeserialiser
{

Expand All @@ -35,8 +33,8 @@ public static ProfileDTO deserialise(String json, FileReader fileReader)
mapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS);
try {
return mapper.readerFor(ProfileDTO.class).readValue(json);
} catch (IOException e) {
throw new UncheckedIOException(e);
} catch (Exception e) {
throw new ValidationException("Profile json is not valid\n" + e.getMessage());
}
}
}
Expand Down

0 comments on commit 402c219

Please sign in to comment.