Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix(container-breakpoint-observer): Added logging information where t…
Browse files Browse the repository at this point in the history
…he placeholder container is applied so tracking this issue if it is occurring again is easier.

Solves #1526
  • Loading branch information
thomaspink committed Aug 27, 2020
1 parent 50e0bcc commit f2625bb
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
occurring;
/**
* @license
* Copyright 2020 Dynatrace LLC
Expand Down Expand Up @@ -36,6 +37,9 @@ import {
convertQuery,
isElementQuery,
} from './query';
import { DtLogger, DtLoggerFactory } from '@dynatrace/barista-components/core';

const LOG: DtLogger = DtLoggerFactory.create('DtContainerBreakpointObserver');

/**
* @internal
Expand Down Expand Up @@ -273,7 +277,20 @@ export class DtContainerBreakpointObserver implements OnDestroy {
placeholder.style.height =
elementQuery.feature === 'height' ? elementQuery.value : '1px';
placeholder.className = PLACEHOLDER_ELEMENT_CLASS;
this._placeholderContainer.nativeElement.append(placeholder);
try {
this._placeholderContainer.nativeElement.append(placeholder);
} catch (ex) {
// This try/catch is there to track down the js-error described the issue #1526.
// TODO: Remove if no errors appear in the future or if the root cause has been found.
const hasAppendMethod =
typeof this._placeholderContainer.nativeElement.append === 'function';
LOG.error(
`Could not create placeholder-container. ` +
`Element-name: ${this._placeholderContainer.nativeElement.tagName}; ` +
`Has append method: ${hasAppendMethod}`,
ex,
);
}

return placeholder;
}
Expand Down

0 comments on commit f2625bb

Please sign in to comment.