Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index.d.ts 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. export class VError extends Error {
  2. static VError: typeof VError;
  3. static cause(err: Error): Error | null;
  4. static info(err: Error): VError.Info;
  5. static fullStack(err: Error): string;
  6. static findCauseByName(err: Error, name: string): Error | null;
  7. static hasCauseWithName(err: Error, name: string): boolean;
  8. static errorFromList<T extends Error>(
  9. errors: T[]
  10. ): null | T | VError.MultiError;
  11. static errorForEach(err: Error, func: (err: Error) => void): void;
  12. cause(): Error | undefined;
  13. constructor(
  14. options: VError.Options | Error,
  15. message: string,
  16. ...params: any[]
  17. );
  18. constructor(message?: string, ...params: any[]);
  19. }
  20. export namespace VError {
  21. interface Info {
  22. [key: string]: any;
  23. }
  24. interface Options {
  25. cause?: Error | null;
  26. name?: string;
  27. strict?: boolean;
  28. constructorOpt?(...args: any[]): void;
  29. info?: Info;
  30. }
  31. /*
  32. * SError is like VError, but stricter about types. You cannot pass "null" or
  33. * "undefined" as string arguments to the formatter. Since SError is only a
  34. * different function, not really a different class, we don't set
  35. * SError.prototype.name.
  36. */
  37. class SError extends VError {}
  38. /*
  39. * PError is like VError, but the message is not run through printf-style
  40. * templating.
  41. */
  42. class PError extends VError {}
  43. /*
  44. * Represents a collection of errors for the purpose of consumers that generally
  45. * only deal with one error. Callers can extract the individual errors
  46. * contained in this object, but may also just treat it as a normal single
  47. * error, in which case a summary message will be printed.
  48. */
  49. class MultiError extends VError {
  50. constructor(errors: Error[]);
  51. errors(): Error[];
  52. }
  53. /*
  54. * Like JavaScript's built-in Error class, but supports a "cause" argument which
  55. * is wrapped, not "folded in" as with VError. Accepts a printf-style message.
  56. * The cause argument can be null.
  57. */
  58. class WError extends VError {}
  59. }