not-implemented-error.js 430 B

1234567891011121314151617181920
  1. import {format} from 'util';
  2. import {valueToString} from '../utils/index.js';
  3. /**
  4. * Not implemented error.
  5. */
  6. export class NotImplementedError extends Error {
  7. /**
  8. * Constructor.
  9. *
  10. * @param pattern
  11. * @param args
  12. */
  13. constructor(pattern, ...args) {
  14. const vars = args.map(valueToString);
  15. const message =
  16. typeof pattern === 'string' ? format(pattern, ...vars) : undefined;
  17. super(message);
  18. }
  19. }