@daiso-tech/core
Version:
The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.
26 lines • 1.04 kB
JavaScript
/**
* @module Serde
*/
import {} from "../../../../serde/contracts/_module.js";
/**
* The `RequiredSerdeAdapter` will always throw errors is used for forcing the user to pass in a valid adapter.
*
* IMPORT_PATH: `"@daiso-tech/core/serde/no-op-serde-adapter"`
* @group Adapters
*/
export class RequiredSerdeAdapter {
static getErrorMessage(methodName) {
return (`[RequiredSerdeAdapter]: The method '${methodName}' was called, but no valid IFlexibleSerdeAdapter was provided. ` +
`You must inject a concrete implementation (e.g., SuperJsonSerdeAdapter) into your configuration.`);
}
serialize(_value) {
throw new Error(RequiredSerdeAdapter.getErrorMessage(this.serialize.name));
}
deserialize(_serializedValue) {
throw new Error(RequiredSerdeAdapter.getErrorMessage(this.deserialize.name));
}
registerCustom(_transformer) {
throw new Error(RequiredSerdeAdapter.getErrorMessage(this.registerCustom.name));
}
}
//# sourceMappingURL=required-serde-adapter.js.map