UNPKG

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