@@ -345,11 +345,8 @@ describe(
345345 } ) ;
346346 setTimeout ( ( ) : any => null ) ;
347347 setTimeout ( ( ) => {
348- expect ( promiseError ! . message )
349- . toBe (
350- 'Uncaught (in promise): ' + error +
351- ( error ! . stack ? '\n' + error ! . stack : '' ) ) ;
352348 expect ( ( promiseError as any ) [ 'rejection' ] ) . toBe ( error ) ;
349+ expect ( promiseError ) . toBe ( error ) ;
353350 expect ( ( promiseError as any ) [ 'zone' ] ) . toBe ( zone ) ;
354351 expect ( ( promiseError as any ) [ 'task' ] ) . toBe ( task ) ;
355352 done ( ) ;
@@ -389,6 +386,39 @@ describe(
389386 } ) ;
390387 } ) ;
391388
389+ it ( 'should print original information when throw a not error object with a message property' ,
390+ ( done ) => {
391+ let promiseError : Error | null = null ;
392+ let zone : Zone | null = null ;
393+ let task : Task | null = null ;
394+ let rejectObj : TestRejection ;
395+ queueZone
396+ . fork ( {
397+ name : 'promise-error' ,
398+ onHandleError : ( delegate : ZoneDelegate , current : Zone , target : Zone , error : any ) :
399+ boolean => {
400+ promiseError = error ;
401+ delegate . handleError ( target , error ) ;
402+ return false ;
403+ }
404+ } )
405+ . run ( ( ) => {
406+ zone = Zone . current ;
407+ task = Zone . currentTask ;
408+ rejectObj = new TestRejection ( ) ;
409+ rejectObj . prop1 = 'value1' ;
410+ rejectObj . prop2 = 'value2' ;
411+ ( rejectObj as any ) . message = 'rejectMessage' ;
412+ Promise . reject ( rejectObj ) ;
413+ expect ( promiseError ) . toBe ( null ) ;
414+ } ) ;
415+ setTimeout ( ( ) : any => null ) ;
416+ setTimeout ( ( ) => {
417+ expect ( promiseError ) . toEqual ( rejectObj as any ) ;
418+ done ( ) ;
419+ } ) ;
420+ } ) ;
421+
392422 describe ( 'Promise.race' , ( ) => {
393423 it ( 'should reject the value' , ( ) => {
394424 queueZone . run ( ( ) => {
0 commit comments