[accelerator] proper error handling

This commit is contained in:
Mononaut
2024-07-05 10:41:59 +00:00
parent 20d948c280
commit b8820684c3
8 changed files with 132 additions and 38 deletions

View File

@@ -1,2 +1,7 @@
<div class="alert" [class]="alertClass" [innerHTML]="errorContent">
</div>
@if (!textOnly) {
<div class="alert" [class]="alertClass" [innerHTML]="errorContent">
</div>
} @else {
<span [class]="alertClass" [innerHTML]="errorContent">
</span>
}

View File

@@ -1,7 +1,7 @@
import { Component, Input, OnInit } from "@angular/core";
import { DomSanitizer, SafeHtml } from "@angular/platform-browser";
const MempoolErrors = {
export const MempoolErrors = {
'bad_request': `Your request was not valid. Please try again.`,
'internal_server_error': `Something went wrong, please try again later`,
'acceleration_duplicated': `This transaction has already been accelerated.`,
@@ -44,6 +44,7 @@ export function isMempoolError(error: string) {
export class MempoolErrorComponent implements OnInit {
@Input() error: string;
@Input() alertClass = 'alert-danger';
@Input() textOnly = false;
errorContent: SafeHtml;
constructor(private sanitizer: DomSanitizer) { }