fix error pipe, improve address errors

This commit is contained in:
Mononaut 2026-01-19 09:06:15 +00:00
parent 774ed45709
commit cee589fa0b
No known key found for this signature in database
GPG key ID: A3F058E41374C04E
3 changed files with 17 additions and 14 deletions

View file

@ -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>

View file

@ -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;

View file

@ -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}` : '';
}
}