Skip to content

Commit

Permalink
feat: print all validation errors for fusion
Browse files Browse the repository at this point in the history
  • Loading branch information
katiestahl committed Sep 25, 2024
1 parent 122af83 commit 7644b8d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
7 changes: 3 additions & 4 deletions client/src/components/Pages/Summary/Invalid/Invalid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ export const Invalid: React.FC<Props> = ({

const unknownError = (
<>
<ListItemText>
We were unable to parse the validation failure for this fusion:
</ListItemText>
<blockquote>{validationErrors}</blockquote>
{validationErrors.map((error) => (
<blockquote>{error}</blockquote>
))}
</>
);

Expand Down
8 changes: 1 addition & 7 deletions client/src/components/Pages/Summary/Main/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,7 @@ export const Summary: React.FC<Props> = ({ setVisibleTab }) => {
// make request
validateFusion(formattedFusion).then((response) => {
if (response.warnings && response.warnings?.length > 0) {
if (
validationErrors !== null &&
JSON.stringify(response.warnings.sort()) !==
JSON.stringify(validationErrors.sort())
) {
setValidationErrors(response.warnings);
}
setValidationErrors(response.warnings);
} else {
setValidationErrors([]);
setValidatedFusion(
Expand Down
2 changes: 1 addition & 1 deletion server/src/curfu/routers/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def validate_fusion(request: Request, fusion: dict = Body()) -> ResponseDict:
try:
verified_fusion = fusor.fusion(**fusion)
except FUSORParametersException as e:
response["warnings"] = [str(e)]
response["warnings"] = str(e).split("\n")
else:
response["fusion"] = verified_fusion
return response

0 comments on commit 7644b8d

Please sign in to comment.