Skip to content

Commit

Permalink
feat(stark-core): removed Throw Error to create stack trace for IE
Browse files Browse the repository at this point in the history
Because the end of support IE we could removed specific code for IE.

ISSUES CLOSED: #3636
  • Loading branch information
mhenkens authored and Unknown committed Sep 19, 2023
1 parent 58c4e7c commit c58408f
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions packages/stark-core/src/modules/http/services/http.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,7 @@ export class StarkHttpServiceImpl<P extends StarkResource> implements StarkHttpS
// That information is not useful for the developer.
// To get a meaningful stack, a dummy meaningful error is created before the subscription to the webservice.
// This meaningfulError is sent to the StarkHttpErrorWrapperImpl and contains all statements up to this method.
let meaningfulError: Error = new Error(starkHttpServiceName + ": Error getting a SingleItemResponse");
if (!meaningfulError.stack) {
// IE 11 won't generate a stack unless the error is thrown
// https://docs.microsoft.com/en-us/scripting/javascript/reference/stack-property-error-javascript#remarks
try {
throw meaningfulError;
} catch (error) {
meaningfulError = error;
}
}
const meaningfulError: Error = new Error(starkHttpServiceName + ": Error getting a SingleItemResponse");

return httpResponse$.pipe(
map((result: HttpResponse<P>) => {
Expand Down Expand Up @@ -322,16 +313,7 @@ export class StarkHttpServiceImpl<P extends StarkResource> implements StarkHttpS
// That information is not useful for the developer.
// To get a meaningful stack, a dummy meaningful error is created before the subscription to the webservice.
// This meaningfulError is sent to the StarkHttpErrorWrapperImpl and contains all statements up to this method.
let meaningfulError: Error = new Error(starkHttpServiceName + ": Error getting a CollectionResponse");
if (!meaningfulError.stack) {
// IE 11 won't generate a stack unless the error is thrown
// https://docs.microsoft.com/en-us/scripting/javascript/reference/stack-property-error-javascript#remarks
try {
throw meaningfulError;
} catch (error) {
meaningfulError = error;
}
}
const meaningfulError: Error = new Error(starkHttpServiceName + ": Error getting a CollectionResponse");

return httpResponse$.pipe(
map((result: HttpResponse<StarkHttpRawCollectionResponseData<P>>) => {
Expand Down

0 comments on commit c58408f

Please sign in to comment.