glitchkit
Version:
A lightweight toolkit to create and manage expressive, structured, and reusable error types. Perfect for APIs, services, and glitchy adventures
71 lines (70 loc) • 1.49 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GlitchKitMetadata = void 0;
class GlitchKitMetadata {
constructor() {
this._tags = [];
}
get info() {
return this._info;
}
set info(data) {
this._info = data;
}
withInfo(data) {
this.info = data;
return this;
}
get context() {
return this._context;
}
set context(ctx) {
this._context = ctx;
}
withContext(ctx) {
this.context = ctx;
return this;
}
get tags() {
return this._tags;
}
set tags(tags) {
this._tags = tags;
}
withTags(tags) {
this.tags = tags;
return this;
}
get category() {
return this._category;
}
set category(category) {
this._category = category;
}
withCategory(category) {
this.category = category;
return this;
}
get cause() {
return this._cause;
}
set cause(cause) {
this._cause = cause;
}
withCause(cause) {
this.cause = cause;
return this;
}
toJson() {
const glitchkitMetadata = {
info: this.info,
context: this.context,
tags: this.tags,
category: this.category,
cause: this.cause,
};
return glitchkitMetadata;
}
}
exports.GlitchKitMetadata = GlitchKitMetadata;
exports.default = GlitchKitMetadata;