mirror of
https://github.com/mempool/mempool.git
synced 2026-08-13 12:33:11 +02:00
fix error pipe, improve address errors
This commit is contained in:
parent
774ed45709
commit
cee589fa0b
3 changed files with 17 additions and 14 deletions
|
|
@ -237,28 +237,29 @@
|
|||
|
||||
<ng-template [ngIf]="error">
|
||||
<br>
|
||||
<ng-template [ngIf]="error.status === 413 || error.status === 405 || error.status === 504" [ngIfElse]="displayServerError">
|
||||
<div class="text-center">
|
||||
<span i18n="address.error.loading-address-data">Error loading address data.</span>
|
||||
<br>
|
||||
<i class="small">({{ error | httpErrorMsg }})</i>
|
||||
<br>
|
||||
@if (!officialMempoolSpace && (error.status === 413 || error.status === 405 || error.status === 504)) {
|
||||
<ng-container i18n="Electrum server limit exceeded error">
|
||||
<br>
|
||||
<i>There are too many transactions on this address, more than your backend can handle. See more on <a href="/docs/faq#address-lookup-issues">setting up a stronger backend</a>.</i>
|
||||
<br><br>
|
||||
Consider viewing this address on the official Mempool website instead:
|
||||
</ng-container>
|
||||
<br>
|
||||
<a href="https://mempool.space/address/{{ addressString }}" target="_blank">https://mempool.space/address/{{ addressString }}</a>
|
||||
<br>
|
||||
<a href="http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/address/{{ addressString }}" target="_blank">http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/address/{{ addressString }}</a>
|
||||
<br><br>
|
||||
<i class="small">({{ error | httpErrorMsg }})</i>
|
||||
} @else if (!officialMempoolSpace) {
|
||||
<br>
|
||||
Consider viewing this address on the official Mempool website instead:
|
||||
}
|
||||
@if (!officialMempoolSpace) {
|
||||
<br>
|
||||
<a href="https://mempool.space/address/{{ addressString }}" target="_blank">https://mempool.space/address/{{ addressString }}</a>
|
||||
<br>
|
||||
<a href="http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/address/{{ addressString }}" target="_blank">http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/address/{{ addressString }}</a>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template #displayServerError>
|
||||
<app-http-error [error]="error">
|
||||
<span i18n="address.error.loading-address-data">Error loading address data.</span>
|
||||
</app-http-error>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ export class AddressComponent implements OnInit, OnDestroy {
|
|||
|
||||
isMobile: boolean;
|
||||
showQR: boolean = false;
|
||||
officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
|
||||
|
||||
address: Address;
|
||||
addressString: string;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { Pipe, PipeTransform } from '@angular/core';
|
|||
})
|
||||
export class HttpErrorPipe implements PipeTransform {
|
||||
transform(e: HttpErrorResponse | null): string {
|
||||
return e ? `${e.status} ${e.statusText}: ${e.error}` : '';
|
||||
const errorMsg = typeof e.error === 'string' ? e.error : e.error?.error ?? '';
|
||||
return e ? `${e.status} ${e.statusText}: ${errorMsg}` : '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue