error.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Base error. Due to limitations of typedoc-check and missing documentation
  3. * in lib.es5.d.ts, cannot extend Error directly for RuntimeError.
  4. * @ignore
  5. */
  6. export declare abstract class BaseError extends Error {
  7. protected static _setPrototypeOf: (o: any, proto: object | null) => any;
  8. }
  9. /**
  10. * Error codes for BaseError
  11. */
  12. export declare const ErrorCodes: {
  13. /** Invalid or empty mesh vertex positions. */
  14. readonly MeshInvalidPositionsError: 0;
  15. /** Unsupported texture found. */
  16. readonly UnsupportedTextureError: 1000;
  17. /** Unexpected magic number found in GLTF file header. */
  18. readonly GLTFLoaderUnexpectedMagicError: 2000;
  19. /** SceneLoader generic error code. Ideally wraps the inner exception. */
  20. readonly SceneLoaderError: 3000;
  21. /** Load file error */
  22. readonly LoadFileError: 4000;
  23. /** Request file error */
  24. readonly RequestFileError: 4001;
  25. /** Read file error */
  26. readonly ReadFileError: 4002;
  27. };
  28. /**
  29. * Error code type
  30. */
  31. export type ErrorCodesType = (typeof ErrorCodes)[keyof typeof ErrorCodes];
  32. /**
  33. * Application runtime error
  34. */
  35. export declare class RuntimeError extends BaseError {
  36. /**
  37. * The error code
  38. */
  39. errorCode: ErrorCodesType;
  40. /**
  41. * The error that caused this outer error
  42. */
  43. innerError?: Error;
  44. /**
  45. * Creates a new RuntimeError
  46. * @param message defines the message of the error
  47. * @param errorCode the error code
  48. * @param innerError the error that caused the outer error
  49. */
  50. constructor(message: string, errorCode: ErrorCodesType, innerError?: Error);
  51. }