UNPKG

trainingpeaks-sdk

Version:
79 lines (78 loc) 3.48 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.WorkoutError = exports.RateLimitError = exports.AuthorizationError = exports.NetworkError = exports.AuthenticationError = exports.ValidationError = exports.TrainingPeaksError = void 0; __exportStar(require("./error-codes.js"), exports); __exportStar(require("./sdk-error.js"), exports); __exportStar(require("./workout-errors.js"), exports); const error_codes_1 = require("./error-codes.js"); const sdk_error_1 = require("./sdk-error.js"); class TrainingPeaksError extends sdk_error_1.SDKError { constructor(message, code, context) { super(message, code || error_codes_1.ERROR_CODES.INTERNAL_ERROR, context); this.name = 'TrainingPeaksError'; Object.setPrototypeOf(this, TrainingPeaksError.prototype); } } exports.TrainingPeaksError = TrainingPeaksError; class ValidationError extends sdk_error_1.SDKError { constructor(message, context) { super(message, error_codes_1.ERROR_CODES.VALIDATION_FAILED, context); this.name = 'ValidationError'; Object.setPrototypeOf(this, ValidationError.prototype); } } exports.ValidationError = ValidationError; class AuthenticationError extends sdk_error_1.SDKError { constructor(message, context) { super(message, error_codes_1.ERROR_CODES.AUTH_FAILED, context); this.name = 'AuthenticationError'; Object.setPrototypeOf(this, AuthenticationError.prototype); } } exports.AuthenticationError = AuthenticationError; class NetworkError extends sdk_error_1.SDKError { constructor(message, context) { super(message, error_codes_1.ERROR_CODES.NETWORK_REQUEST_FAILED, context); this.name = 'NetworkError'; Object.setPrototypeOf(this, NetworkError.prototype); } } exports.NetworkError = NetworkError; class AuthorizationError extends sdk_error_1.SDKError { constructor(message, context) { super(message, error_codes_1.ERROR_CODES.AUTH_FAILED, context); this.name = 'AuthorizationError'; Object.setPrototypeOf(this, AuthorizationError.prototype); } } exports.AuthorizationError = AuthorizationError; class RateLimitError extends sdk_error_1.SDKError { constructor(message, context) { super(message, error_codes_1.ERROR_CODES.NETWORK_REQUEST_FAILED, context); this.name = 'RateLimitError'; Object.setPrototypeOf(this, RateLimitError.prototype); } } exports.RateLimitError = RateLimitError; class WorkoutError extends sdk_error_1.SDKError { constructor(message, context) { super(message, error_codes_1.ERROR_CODES.WORKOUT_CREATION_FAILED, context); this.name = 'WorkoutError'; Object.setPrototypeOf(this, WorkoutError.prototype); } } exports.WorkoutError = WorkoutError;