ref_error.ts 513 B

12345678910111213
  1. import {resolveUrl, normalizeId, getFullPath} from "./resolve"
  2. import type {UriResolver} from "../types"
  3. export default class MissingRefError extends Error {
  4. readonly missingRef: string
  5. readonly missingSchema: string
  6. constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string) {
  7. super(msg || `can't resolve reference ${ref} from id ${baseId}`)
  8. this.missingRef = resolveUrl(resolver, baseId, ref)
  9. this.missingSchema = normalizeId(getFullPath(resolver, this.missingRef))
  10. }
  11. }