Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit 1cc1e2e

Browse files
authored
Merge pull request #268 from North-Two-Five/feature/throws-over-32kb
throws error when message is over 32kb
2 parents e39cf68 + 1241ade commit 1cc1e2e

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,7 @@ class Analytics {
6262
}
6363

6464
_validate (message, type) {
65-
try {
66-
looselyValidate(message, type)
67-
} catch (e) {
68-
if (e.message === 'Your message must be < 32kb.') {
69-
console.log('Your message must be < 32kb. This is currently surfaced as a warning to allow clients to update. Versions released after August 1, 2018 will throw an error instead. Please update your code before then.', message)
70-
return
71-
}
72-
throw e
73-
}
65+
looselyValidate(message, type)
7466
}
7567

7668
/**

test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ test('isErrorRetryable', t => {
561561
t.false(client._isErrorRetryable({ response: { status: 200 } }))
562562
})
563563

564-
test('allows messages > 32kb', t => {
564+
test('dont allow messages > 32kb', t => {
565565
const client = createClient()
566566

567567
const event = {
@@ -573,7 +573,7 @@ test('allows messages > 32kb', t => {
573573
event.properties[i] = 'a'
574574
}
575575

576-
t.notThrows(() => {
576+
t.throws(() => {
577577
client.track(event, noop)
578578
})
579579
})

0 commit comments

Comments
 (0)