mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-07 20:44:05 +09:00
The main reason for this change is the realization that a product needs some more protection than a typical library. With this change it is still an Open Source Core, but now corporations can't build on top of it without contributing back to the OSS community or without buying a license.
Error utils
API
captureError(error, value)
- Provides a compile error when value is not
never - Throws a runtime error in development synchronously to break intentionally
- Throws an error in production asynchronously to not break unintentionally
import { captureError } from "error-utils";
const fn = (value: { type: string }) => {
if (value.type === "foo") {
return value;
}
return captureError(new Error("Should never happen"), value);
};