File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -630,9 +630,17 @@ Log.prototype.decorateEntries_ = function(entries, callback) {
630630 entry = self . entry ( entry ) ;
631631 }
632632
633- var decoratedEntry = entry . toJSON ( {
634- removeCircular : self . removeCircular_
635- } ) ;
633+ var decoratedEntry ;
634+
635+ try {
636+ decoratedEntry = entry . toJSON ( {
637+ removeCircular : self . removeCircular_
638+ } ) ;
639+ } catch ( e ) {
640+ callback ( e ) ;
641+ return ;
642+ }
643+
636644 decoratedEntry . logName = self . formattedName_ ;
637645
638646 self . metadata_ . assignDefaultResource ( decoratedEntry , function ( err , entry ) {
Original file line number Diff line number Diff line change @@ -696,6 +696,20 @@ describe('Log', function() {
696696 log . decorateEntries_ ( [ entry ] , assert . ifError ) ;
697697 } ) ;
698698
699+ it ( 'should exec callback with error from serialization' , function ( done ) {
700+ var error = new Error ( 'Error.' ) ;
701+
702+ var entry = new Entry ( ) ;
703+ entry . toJSON = function ( ) {
704+ throw error ;
705+ } ;
706+
707+ log . decorateEntries_ ( [ entry ] , function ( err ) {
708+ assert . strictEqual ( err , error ) ;
709+ done ( ) ;
710+ } ) ;
711+ } ) ;
712+
699713 it ( 'should assign the log name' , function ( done ) {
700714 log . decorateEntries_ ( [ { } ] , function ( err , decoratedEntries ) {
701715 assert . ifError ( err ) ;
You can’t perform that action at this time.
0 commit comments