xray-docs/helm/charts/helm-library/templates/_errors.tpl
Nikolai Rodionov 65b90453dc
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Add the helm chart
2025-01-18 11:59:15 +01:00

16 lines
641 B
Smarty

{{- define "lib.error.noCtx" -}} {{- /* define[0] */ -}}
{{- if not .ctx -}}{{- fail "no context provided" -}}{{- end -}}
{{- if not (kindIs "map" .ctx) -}} {{- /* if[1] */ -}}
{{- fail "unexpected type of ctx" -}}
{{- end -}} {{- /* /if[1] */ -}}
{{- end -}} {{- /* /define[0] */ -}}
{{- define "lib.error.noKey" -}} {{- /* define[0] */ -}}
{{- include "lib.error.noCtx" . -}}
{{- if not .key -}}{{ fail "error handler must receive a key to find" }}{{- end -}}
{{- if not (hasKey .ctx .key) -}} {{- /* if[1] */ -}}
{{- fail (printf "key %s must be not null" .key) -}}
{{- end -}} {{- /* /if[1] */ -}}
{{- end -}} {{- /* /define[0] */ -}}