Merge pull request #5279 from mempool/natsoni/error-message-context
Add more context to error messages
This commit is contained in:
		
						commit
						769bb6f1be
					
				| @ -364,7 +364,7 @@ | |||||||
|   </ng-template> |   </ng-template> | ||||||
|   <ng-template [ngIf]="error"> |   <ng-template [ngIf]="error"> | ||||||
|     <app-http-error [error]="error"> |     <app-http-error [error]="error"> | ||||||
|       <span i18n="error.general-loading-data">Error loading data.</span> |       <span i18n="block.error.loading-block-data">Error loading block data.</span> | ||||||
|     </app-http-error> |     </app-http-error> | ||||||
|   </ng-template> |   </ng-template> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| <app-indexing-progress></app-indexing-progress> | <app-indexing-progress></app-indexing-progress> | ||||||
| 
 | 
 | ||||||
| <div class="container-xl"> | <div class="container-xl" *ngIf="!error; else errorTemplate"> | ||||||
| 
 | 
 | ||||||
|   <!-- Pool overview --> |   <!-- Pool overview --> | ||||||
|   <div *ngIf="poolStats$ | async as poolStats; else loadingMain"> |   <div *ngIf="poolStats$ | async as poolStats; else loadingMain"> | ||||||
| @ -460,3 +460,10 @@ | |||||||
| <ng-template #emptyTd> | <ng-template #emptyTd> | ||||||
|   <td class="text-center"></td> |   <td class="text-center"></td> | ||||||
| </ng-template> | </ng-template> | ||||||
|  | 
 | ||||||
|  | <ng-template #errorTemplate> | ||||||
|  |   <br> | ||||||
|  |   <app-http-error [error]="error"> | ||||||
|  |     <span i18n="pool.error.loading-pool-data">Error loading pool data.</span> | ||||||
|  |   </app-http-error> | ||||||
|  | </ng-template> | ||||||
| @ -9,6 +9,7 @@ import { StateService } from '../../services/state.service'; | |||||||
| import { selectPowerOfTen } from '../../bitcoin.utils'; | import { selectPowerOfTen } from '../../bitcoin.utils'; | ||||||
| import { formatNumber } from '@angular/common'; | import { formatNumber } from '@angular/common'; | ||||||
| import { SeoService } from '../../services/seo.service'; | import { SeoService } from '../../services/seo.service'; | ||||||
|  | import { HttpErrorResponse } from '@angular/common/http'; | ||||||
| 
 | 
 | ||||||
| interface AccelerationTotal { | interface AccelerationTotal { | ||||||
|   cost: number, |   cost: number, | ||||||
| @ -33,6 +34,7 @@ export class PoolComponent implements OnInit { | |||||||
|   blocks$: Observable<BlockExtended[]>; |   blocks$: Observable<BlockExtended[]>; | ||||||
|   oobFees$: Observable<AccelerationTotal[]>; |   oobFees$: Observable<AccelerationTotal[]>; | ||||||
|   isLoading = true; |   isLoading = true; | ||||||
|  |   error: HttpErrorResponse | null = null; | ||||||
| 
 | 
 | ||||||
|   chartOptions: EChartsOption = {}; |   chartOptions: EChartsOption = {}; | ||||||
|   chartInitOptions = { |   chartInitOptions = { | ||||||
| @ -105,6 +107,10 @@ export class PoolComponent implements OnInit { | |||||||
|           } |           } | ||||||
|           return this.apiService.getPoolBlocks$(this.slug, this.blocks[this.blocks.length - 1]?.height); |           return this.apiService.getPoolBlocks$(this.slug, this.blocks[this.blocks.length - 1]?.height); | ||||||
|         }), |         }), | ||||||
|  |         catchError((err) => { | ||||||
|  |           this.error = err; | ||||||
|  |           return of([]); | ||||||
|  |         }), | ||||||
|         tap((newBlocks) => { |         tap((newBlocks) => { | ||||||
|           this.blocks = this.blocks.concat(newBlocks); |           this.blocks = this.blocks.concat(newBlocks); | ||||||
|         }), |         }), | ||||||
|  | |||||||
| @ -4,6 +4,6 @@ import { Pipe, PipeTransform } from '@angular/core'; | |||||||
| @Pipe({ name: 'httpErrorMsg' }) | @Pipe({ name: 'httpErrorMsg' }) | ||||||
| export class HttpErrorPipe implements PipeTransform { | export class HttpErrorPipe implements PipeTransform { | ||||||
|   transform(e: HttpErrorResponse | null): string { |   transform(e: HttpErrorResponse | null): string { | ||||||
|     return e ? `${e.status}: ${e.statusText}` : ''; |     return e ? `${e.status} ${e.statusText}: ${e.error}` : ''; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user