Skip to content

Commit

Permalink
Merge branch 'master' into j21tc9
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanrdoherty committed Aug 6, 2024
2 parents cdde209 + 4fc6683 commit f413d5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.gusdb.wdk.model.user.UserPreferences;
import org.gusdb.wdk.service.UserBundle;
import org.gusdb.wdk.service.formatter.UserFormatter;
import org.gusdb.wdk.service.formatter.ValidationFormatter;
import org.gusdb.wdk.service.request.exception.ConflictException;
import org.gusdb.wdk.service.request.exception.DataValidationException;
import org.gusdb.wdk.service.request.exception.RequestMisformatException;
Expand Down Expand Up @@ -91,10 +92,12 @@ public Response setUserProfile(String body)
throw new BadRequestException(e);
}
catch (InvalidPropertiesException e) {
throw new DataValidationException(e.getMessage());
// convert to use validation bundle JSON formatting
throw new DataValidationException(ValidationFormatter.getValidationBundleJson(e.getMessage()).toString());
}
catch (InvalidUsernameOrEmailException e) {
throw new ConflictException(e.getMessage());
// convert to use validation bundle JSON formatting
throw new ConflictException(ValidationFormatter.getValidationBundleJson(e.getMessage()).toString());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.gusdb.wdk.model.user.User;
import org.gusdb.wdk.model.user.UserPreferenceFactory;
import org.gusdb.wdk.model.user.UserPreferences;
import org.gusdb.wdk.service.formatter.ValidationFormatter;
import org.gusdb.wdk.service.request.exception.ConflictException;
import org.gusdb.wdk.service.request.exception.DataValidationException;
import org.gusdb.wdk.service.request.exception.RequestMisformatException;
Expand Down Expand Up @@ -77,11 +78,13 @@ public Response createNewUser(String body) throws RequestMisformatException, Dat
.location(getUriInfo().getAbsolutePathBuilder().build(newUser.getUserId()))
.build();
}
catch (InvalidUsernameOrEmailException e) {
throw new ConflictException(e.getMessage());
}
catch (InvalidPropertiesException e) {
throw new DataValidationException(e.getMessage());
// convert to use validation bundle JSON formatting
throw new DataValidationException(ValidationFormatter.getValidationBundleJson(e.getMessage()).toString());
}
catch (InvalidUsernameOrEmailException e) {
// convert to use validation bundle JSON formatting
throw new ConflictException(ValidationFormatter.getValidationBundleJson(e.getMessage()).toString());
}
catch (JSONException e) {
throw new RequestMisformatException(e.getMessage(), e);
Expand Down

0 comments on commit f413d5a

Please sign in to comment.