Skip to content

Commit

Permalink
general subnet errors i think this works for real
Browse files Browse the repository at this point in the history
  • Loading branch information
coliu-akamai committed Dec 9, 2024
1 parent 9a35ffc commit b96c7ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,17 @@ export const SubnetContent = (props: Props) => {
</Link>
.
</StyledBodyTypography>
{errors.subnets?.message && (
{errors.root?.subnetLabel && (
<Notice
spacingBottom={8}
text={errors.subnets.message}
text={errors.root.subnetLabel.message}
variant="error"
/>
)}
{errors.root?.subnetIPv4 && (
<Notice
spacingBottom={8}
text={errors.root.subnetIPv4.message}
variant="error"
/>
)}
Expand Down
9 changes: 4 additions & 5 deletions packages/manager/src/hooks/useCreateVPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ export const useCreateVPC = (inputs: UseCreateVPCInputs) => {
}
} catch (errors) {
for (const error of errors) {
if (
error?.field === 'subnets.label' ||
error?.field === 'subnets.ipv4'
) {
form.setError('subnets', { message: error.reason });
if (error?.field === 'subnets.label') {
form.setError('root.subnetLabel', { message: error.reason });
} else if (error?.field === 'subnets.ipv4') {
form.setError('root.subnetIPv4', { message: error.reason });
} else {
form.setError(error?.field ?? 'root', { message: error.reason });
}
Expand Down

0 comments on commit b96c7ab

Please sign in to comment.