Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit bad42a0

Browse files
fix: on error the message is always the same
1 parent 2b63f6d commit bad42a0

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/bootstrap.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ export default () => {
2727
]
2828

2929
if (shouldGaLoad() && (!window.ga || !noScript)) {
30-
queue.push(loadScript(resource))
30+
queue.push(
31+
loadScript(resource).catch(() => {
32+
throw new Error (
33+
`[vue-analytics] An error occured! Please check your connection, ` +
34+
`if you have any Google Analytics blocker installed in your browser ` +
35+
`or check your custom resource URL if you have added any.`
36+
)
37+
})
38+
)
3139
}
3240

3341
return Promise.all(queue).then(response => {
@@ -51,11 +59,7 @@ export default () => {
5159

5260
// Starts auto tracking
5361
autoTracking()
54-
}).catch(response => {
55-
console.error(
56-
`[vue-analytics] An error occured! Please check your connection, ` +
57-
`if you have any Google Analytics blocker installed in your browser ` +
58-
`or check your custom resource URL if you have added any.`
59-
)
62+
}).catch(error => {
63+
console.error(error.message)
6064
})
6165
}

0 commit comments

Comments
 (0)