Skip to content

Commit b3a460b

Browse files
committed
Expose getErrors to public API. It's needed for custom error handlers.
1 parent c36b5d8 commit b3a460b

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,5 @@ export const addErrorHandler: (handler: ErrorHandler) => void;
7373
export type ErrorHandler = (normalizedErrors: InstanceOutput, instance: JsonNode, localization: Localization) => Promise<ErrorObject[]>;
7474

7575
export const evaluateSchema: (schemaLocation: string, instance: JsonNode, context: EvaluationContext) => NormalizedOutput;
76+
77+
export const getErrors: (normalizedErrors: NormalizedOutput, rootInstance: JsonNode, language: Localization) => Promise<ErrorObject[]>;

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ addErrorHandler(unknownErrorHandler);
171171
export {
172172
addErrorHandler,
173173
evaluateSchema,
174+
getErrors,
174175
jsonSchemaErrors,
175176
setNormalizationHandler
176177
} from "./json-schema-errors.js";

src/json-schema-errors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export const addErrorHandler = (errorHandler) => {
181181
errorHandlers.push(errorHandler);
182182
};
183183

184-
/** @type (normalizedErrors: API.NormalizedOutput, rootInstance: JsonNode, language: Localization) => Promise<API.ErrorObject[]> */
184+
/** @type API.getErrors */
185185
export const getErrors = async (normalizedErrors, rootInstance, localization) => {
186186
/** @type API.ErrorObject[] */
187187
const errors = [];

0 commit comments

Comments
 (0)