Skip to content

Commit

Permalink
1-1329: return 400 when pattern is empty but example is not (#4609)
Browse files Browse the repository at this point in the history
Adding an example when there is no pattern doesn't make any sense, so it
should be an error.

Tests in ivarconr/unleash-enterprise#721
  • Loading branch information
thomasheartman authored Sep 5, 2023
1 parent 848b35a commit 8a8a7b0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/services/project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ export default class ProjectService {
`You've provided a feature flag naming example ("${example}") that doesn't match your feature flag naming pattern ("${pattern}"). Please provide an example that matches your supplied pattern.`,
);
}

if (!pattern && example) {
throw new BadDataError(
"You've provided a feature flag naming example, but no feature flag naming pattern. You must specify a pattern to use an example.",
);
}
}
};

Expand Down

0 comments on commit 8a8a7b0

Please sign in to comment.