We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently InvalidPatch and PatchApplyError are being exported as interfaces, i.e. static only.
InvalidPatch
PatchApplyError
Classes are useful at runtime for distinguishing between errors.
Workaround:
import { apply_patch, InvalidPatch, PatchApplyError } from 'jsonpatch'; declare module 'jsonpatch' { export class InvalidPatch extends Error {} export class PatchApplyError extends Error {} } try { apply_patch(document, patch); } catch (e: unknown) { if (e instanceof InvalidPatch) { console.error('Invalid patch format'); } }
The text was updated successfully, but these errors were encountered:
I also need this.
Sorry, something went wrong.
Export error classes
b9a9aa4
Fixes dharmafly#41
I made a PR for this: #41
No branches or pull requests
Currently
InvalidPatch
andPatchApplyError
are being exported as interfaces, i.e. static only.Classes are useful at runtime for distinguishing between errors.
Workaround:
The text was updated successfully, but these errors were encountered: