MCPcopy Create free account
hub / github.com/eclipsesource/jsonforms / getCombinedErrorMessage

Function getCombinedErrorMessage

packages/core/src/i18n/i18nUtil.ts:130–152  ·  view source on GitHub ↗
(
  errors: ErrorObject[],
  et: ErrorTranslator,
  t: Translator,
  schema?: i18nJsonSchema,
  uischema?: UISchemaElement,
  path?: string
)

Source from the content-addressed store, hash-verified

128 * All errors must correspond to the given schema, uischema or path.
129 */
130export const getCombinedErrorMessage = (
131 errors: ErrorObject[],
132 et: ErrorTranslator,
133 t: Translator,
134 schema?: i18nJsonSchema,
135 uischema?: UISchemaElement,
136 path?: string
137) => {
138 if (errors.length > 0 && t) {
139 // check whether there is a special message which overwrites all others
140 const customErrorKey = getI18nKey(schema, uischema, path, 'error.custom');
141 const specializedErrorMessage = t(customErrorKey, undefined, {
142 schema,
143 uischema,
144 path,
145 errors,
146 });
147 if (specializedErrorMessage !== undefined) {
148 return specializedErrorMessage;
149 }
150 }
151 return formatErrorMessage(errors.map((error) => et(error, t, uischema)));
152};
153
154/**
155 * This can be used to internationalize the label of the given Labelable (e.g. UI Schema elements).

Callers 4

mapStateToControlPropsFunction · 0.90
mapStateToCellPropsFunction · 0.90
useVuetifyControlFunction · 0.90

Calls 2

formatErrorMessageFunction · 0.90
getI18nKeyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…