@shapediver/viewer.shared.services
Advanced tools
Comparing version 1.14.7 to 1.14.8
@@ -27,2 +27,3 @@ "use strict"; | ||
const tsyringe_1 = require("tsyringe"); | ||
const ShapeDiverViewerErrors_1 = require("../logger/ShapeDiverViewerErrors"); | ||
let HttpClient = class HttpClient { | ||
@@ -37,4 +38,9 @@ // #endregion Properties (2) | ||
}, error => { | ||
throw error; | ||
throw new ShapeDiverViewerErrors_1.ShapeDiverViewerConnectionError(error.message, error.response.status, error); | ||
}); | ||
axios_1.default.interceptors.request.use(response => { | ||
return response; | ||
}, error => { | ||
throw new ShapeDiverViewerErrors_1.ShapeDiverViewerConnectionError(error.message, undefined, error); | ||
}); | ||
} | ||
@@ -56,12 +62,8 @@ // #endregion Constructors (1) | ||
return yield this._dataCache[dataKey]; | ||
this._dataCache[dataKey] = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { | ||
if (this._loadData) { | ||
const response = yield this._loadData(href, config); | ||
resolve(response); | ||
} | ||
else { | ||
const response = yield this.get(href, config); | ||
resolve(response); | ||
} | ||
})); | ||
if (this._loadData) { | ||
this._dataCache[dataKey] = this._loadData(href, config); | ||
} | ||
else { | ||
this._dataCache[dataKey] = this.get(href, config); | ||
} | ||
return yield this._dataCache[dataKey]; | ||
@@ -68,0 +70,0 @@ }); |
@@ -203,4 +203,7 @@ "use strict"; | ||
const messageProperty = e && e.message ? e.message : `An unknown issue occurred in ${scope}.`; | ||
if (logToSentry) | ||
this.sentryError(topic, e, messageProperty); | ||
if (logToSentry) { | ||
if (!(e instanceof ShapeDiverViewerErrors_1.ShapeDiverViewerConnectionError) || (e.status && e.status >= 500)) { | ||
this.sentryError(topic, e, messageProperty); | ||
} | ||
} | ||
throw e; | ||
@@ -207,0 +210,0 @@ } |
export declare enum ShapeDiverViewerErrorType { | ||
AR_ERROR = "SdARError", | ||
CAMERA_ERROR = "SdCameraError", | ||
CONNECTION_ERROR = "SdConnectionError", | ||
DATA_PROCESSING_ERROR = "SdDataProcessingError", | ||
@@ -5,0 +6,0 @@ ENVIRONMENT_MAP_ERROR = "SdEnvironmentMapError", |
@@ -8,2 +8,3 @@ "use strict"; | ||
ShapeDiverViewerErrorType["CAMERA_ERROR"] = "SdCameraError"; | ||
ShapeDiverViewerErrorType["CONNECTION_ERROR"] = "SdConnectionError"; | ||
ShapeDiverViewerErrorType["DATA_PROCESSING_ERROR"] = "SdDataProcessingError"; | ||
@@ -10,0 +11,0 @@ ShapeDiverViewerErrorType["ENVIRONMENT_MAP_ERROR"] = "SdEnvironmentMapError"; |
@@ -60,2 +60,8 @@ import { ShapeDiverViewerError } from "./ShapeDiverError"; | ||
} | ||
export declare class ShapeDiverViewerConnectionError extends ShapeDiverViewerError { | ||
readonly message: string; | ||
readonly status?: number | undefined; | ||
readonly errorObject?: Error | undefined; | ||
constructor(message: string, status?: number | undefined, errorObject?: Error | undefined); | ||
} | ||
//# sourceMappingURL=ShapeDiverViewerErrors.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ShapeDiverViewerValidationError = exports.ShapeDiverViewerArError = exports.ShapeDiverViewerGeneralError = exports.ShapeDiverViewerCameraError = exports.ShapeDiverViewerLightError = exports.ShapeDiverViewerSessionError = exports.ShapeDiverViewerSettingsError = exports.ShapeDiverViewerWebGLError = exports.ShapeDiverViewerEnvironmentMapError = exports.ShapeDiverViewerDataProcessingError = exports.ShapeDiverViewerUnknownError = void 0; | ||
exports.ShapeDiverViewerConnectionError = exports.ShapeDiverViewerValidationError = exports.ShapeDiverViewerArError = exports.ShapeDiverViewerGeneralError = exports.ShapeDiverViewerCameraError = exports.ShapeDiverViewerLightError = exports.ShapeDiverViewerSessionError = exports.ShapeDiverViewerSettingsError = exports.ShapeDiverViewerWebGLError = exports.ShapeDiverViewerEnvironmentMapError = exports.ShapeDiverViewerDataProcessingError = exports.ShapeDiverViewerUnknownError = void 0; | ||
const ShapeDiverError_1 = require("./ShapeDiverError"); | ||
@@ -97,2 +97,11 @@ class ShapeDiverViewerUnknownError extends ShapeDiverError_1.ShapeDiverViewerError { | ||
exports.ShapeDiverViewerValidationError = ShapeDiverViewerValidationError; | ||
class ShapeDiverViewerConnectionError extends ShapeDiverError_1.ShapeDiverViewerError { | ||
constructor(message, status, errorObject) { | ||
super(ShapeDiverError_1.ShapeDiverViewerErrorType.CONNECTION_ERROR, 'An error occurred while loading data.', message); | ||
this.message = message; | ||
this.status = status; | ||
this.errorObject = errorObject; | ||
} | ||
} | ||
exports.ShapeDiverViewerConnectionError = ShapeDiverViewerConnectionError; | ||
//# sourceMappingURL=ShapeDiverViewerErrors.js.map |
{ | ||
"name": "@shapediver/viewer.shared.services", | ||
"version": "1.14.7", | ||
"version": "1.14.8", | ||
"description": "", | ||
@@ -44,3 +44,3 @@ "keywords": [], | ||
"@shapediver/viewer.settings": "0.1.36", | ||
"@shapediver/viewer.shared.build-data": "1.14.7", | ||
"@shapediver/viewer.shared.build-data": "1.14.8", | ||
"@types/dompurify": "^2.3.1", | ||
@@ -56,3 +56,3 @@ "@types/ua-parser-js": "^0.7.36", | ||
}, | ||
"gitHead": "2464b06c91eff38d2c35b310956989153f427d73" | ||
"gitHead": "7cd69ef01d47544af167e00e879fadfbae35ffbe" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
210360
2716
+ Added@shapediver/viewer.shared.build-data@1.14.8(transitive)
- Removed@shapediver/viewer.shared.build-data@1.14.7(transitive)