Skip to content

Commit

Permalink
feat: add datalayer errors
Browse files Browse the repository at this point in the history
  • Loading branch information
emkis committed Apr 4, 2022
1 parent 0a7a446 commit 2895be6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/data-layer/data-layer-error.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { WarningError } from '../error'

export function throwIsServer() {
throw new WarningError(
'window.dataLayer is not available on server-side. Make sure to only trigger events after your app is running on the client-side.'
)
}

export function throwIsNotDefined() {
throw new WarningError(
'window.dataLayer is not defined. Probably you forgot to add the Google Tag Manager script to your application.'
)
}

export function throwIsNotArray() {
throw new WarningError(
'window.dataLayer is not an array. Make sure you installed Google Tag Manager correctly.'
)
}

0 comments on commit 2895be6

Please sign in to comment.