@@ -668,10 +668,7 @@ function processException(type, message, fileurl, lineno, frames, options) {
668
668
if ( ! ! globalOptions . ignoreErrors . test && globalOptions . ignoreErrors . test ( message ) ) return ;
669
669
670
670
message += '' ;
671
- message = truncate ( message , globalOptions . maxMessageLength ) ;
672
-
673
671
fullMessage = type + ': ' + message ;
674
- fullMessage = truncate ( fullMessage , globalOptions . maxMessageLength ) ;
675
672
676
673
if ( frames && frames . length ) {
677
674
fileurl = frames [ 0 ] . filename || fileurl ;
@@ -723,6 +720,19 @@ function truncate(str, max) {
723
720
return str . length <= max ? str : str . substr ( 0 , max ) + '\u2026' ;
724
721
}
725
722
723
+ function trimPacket ( data ) {
724
+ // For now, we only want to truncate the two different messages
725
+ // but this could/should be expanded to just trim everything
726
+ var max = globalOptions . maxMessageLength ;
727
+ data . message = truncate ( data . message , max ) ;
728
+ if ( data . exception ) {
729
+ var exception = data . exception . values [ 0 ] ;
730
+ exception . value = truncate ( exception . value , max ) ;
731
+ }
732
+
733
+ return data ;
734
+ }
735
+
726
736
function now ( ) {
727
737
return + new Date ( ) ;
728
738
}
@@ -797,6 +807,9 @@ function send(data) {
797
807
// Set lastEventId after we know the error should actually be sent
798
808
lastEventId = data . event_id || ( data . event_id = uuid4 ( ) ) ;
799
809
810
+ // Try and clean up the packet before sending by truncating long values
811
+ data = trimPacket ( data ) ;
812
+
800
813
logDebug ( 'debug' , 'Raven about to send:' , data ) ;
801
814
802
815
if ( ! isSetup ( ) ) return ;
0 commit comments