| 
									
										
										
										
											2017-01-27 13:19:00 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-09 13:49:16 -08:00
										 |  |  | import {ERROR_DEBUG_CONTEXT, ERROR_LOGGER, ERROR_ORIGINAL_ERROR, ERROR_TYPE} from './util/errors'; | 
					
						
							| 
									
										
										
										
											2017-01-27 13:19:00 -08:00
										 |  |  | import {DebugContext} from './view'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function getType(error: Error): Function { | 
					
						
							|  |  |  |   return (error as any)[ERROR_TYPE]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function getDebugContext(error: Error): DebugContext { | 
					
						
							|  |  |  |   return (error as any)[ERROR_DEBUG_CONTEXT]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function getOriginalError(error: Error): Error { | 
					
						
							|  |  |  |   return (error as any)[ERROR_ORIGINAL_ERROR]; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-03-14 09:16:15 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | export function getErrorLogger(error: Error): (console: Console, ...values: any[]) => void { | 
					
						
							|  |  |  |   return (error as any)[ERROR_LOGGER] || defaultErrorLogger; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function defaultErrorLogger(console: Console, ...values: any[]) { | 
					
						
							|  |  |  |   (<any>console.error)(...values); | 
					
						
							|  |  |  | } |