UNPKG

@open-rpc/schema-utils-js

Version:

<center> <span> <img alt="CircleCI branch" src="https://img.shields.io/circleci/project/github/open-rpc/schema-utils-js/master.svg"> <img src="https://codecov.io/gh/open-rpc/schema-utils-js/branch/master/graph/badge.svg" /> <img alt="npm" sr

21 lines (20 loc) 840 B
import { ErrorObject } from "ajv"; import { JSONSchema } from "@open-rpc/meta-schema"; /** * Provides an error interface for handling when a function call has invalid parameters. */ export default class ParameterValidationError implements Error { paramIndex: number | string; expectedSchema: JSONSchema; receievedParam: any; name: string; message: string; /** * @param paramIndex The index of the param that for this error (index * of the param in MethodObject.params). * @param expectedSchema The expected JSON Schema for the passed in value. * @param receievedParam The value of the param passed to the method call. * @param errors The errors recieved by ajv */ constructor(paramIndex: number | string, expectedSchema: JSONSchema, receievedParam: any, errors: ErrorObject[]); }