belgattitude/httpx

View on GitHub
packages/exception/src/utils/initProtoAndName.ts

Summary

Maintainability
A
0 mins
Test Coverage
import type { HttpException } from '../base/HttpException';

/**
 * @internal
 */
export const initProtoAndName = (
  obj: HttpException | Error,
  name: string,
  cls: { prototype: object }
) => {
  Object.setPrototypeOf(obj, cls.prototype);
  obj.name = `Http${name}`;
};