Skip to content

Commit 9049481

Browse files
committed
feat: lagt til error codes
1 parent 7ad7b3b commit 9049481

File tree

1 file changed

+5
-5
lines changed
  • actions/spa-setup-task/src

1 file changed

+5
-5
lines changed

Diff for: actions/spa-setup-task/src/spa.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -141,24 +141,24 @@ export function validateInputs(
141141
): Error | null {
142142
if (!isValidAppName(team)) {
143143
return Error(
144-
`Invalid team name: ${team}. Team name must match regex: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
144+
`SPADEPLOY-001: Invalid team name: ${team}. Team name must match regex: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
145145
)
146146
}
147147

148148
if (!isValidAppName(app)) {
149149
return Error(
150-
`Invalid app name: ${app}. App name must match regex: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
150+
`SPADEPLOY-002: Invalid app name: ${app}. App name must match regex: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
151151
)
152152
}
153153

154154
if (!isValidAppName(environment)) {
155155
return Error(
156-
`Invalid environment name: ${environment}. Environment name must match regex: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
156+
`SPADEPLOY-003: Invalid environment name: ${environment}. Environment name must match regex: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
157157
)
158158
}
159159

160160
if (ingress.length === 0) {
161-
return Error('No ingress specified')
161+
return Error('SPADEPLOY-004: No ingress specified')
162162
}
163163

164164
if (hasCustomIngressClass(ingressClass)) {
@@ -209,7 +209,7 @@ export function spaSetupTask(
209209

210210
if (naisClusterFinal !== naisCluster) {
211211
throw Error(
212-
`Ingresses must be on same cluster. Found ${naisClusterFinal} and ${naisCluster}`
212+
`SPADEPLOY-005: ngresses must be on same cluster. Found ${naisClusterFinal} and ${naisCluster}`
213213
)
214214
}
215215
}

0 commit comments

Comments
 (0)