MCPcopy Index your code
hub / github.com/coder/coder / mapApiErrorToFieldErrors

Function mapApiErrorToFieldErrors

site/src/api/errors.ts:54–66  ·  view source on GitHub ↗
(
	apiErrorResponse: ApiErrorResponse,
)

Source from the content-addressed store, hash-verified

52 error !== undefined && error !== null;
53
54export const mapApiErrorToFieldErrors = (
55 apiErrorResponse: ApiErrorResponse,
56): FieldErrors => {
57 const result: FieldErrors = {};
58
59 if (apiErrorResponse.validations) {
60 for (const error of apiErrorResponse.validations) {
61 result[error.field] = error.detail || "Invalid value";
62 }
63 }
64
65 return result;
66};
67
68/**
69 *

Callers 4

getFormHelpersFunction · 0.90
getSecretFieldErrorsFunction · 0.90
OAuth2AppFormFunction · 0.90
errors.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected