error management

This commit is contained in:
2024-10-27 20:06:51 +01:00
parent 19177eefdf
commit f404ad3088
14 changed files with 93 additions and 72 deletions
+15 -2
View File
@@ -12,7 +12,10 @@ export class I18nPipe implements PipeTransform {
constructor(private i18n: I18nService) {
}
transform(value: String, ...args: any[]): String {
transform(value: string, ...args: any[]): string {
if (args.length === 1 && Array.isArray(args[0])) {
args = args[0];
}
return this.i18n.get(value, args);
}
}
@@ -25,7 +28,17 @@ export class I18nEmptyPipe implements PipeTransform {
constructor(private i18n: I18nService) {
}
transform(value: String, ...args: any[]): String {
transform(value: string, ...args: any[]): string {
return this.i18n.getEmpty(value, args);
}
}
@Pipe({
name: 'errorCode'
})
export class ErrorCodePipe implements PipeTransform {
transform(value: string): string {
return value && value.toUpperCase().replaceAll('-', '_') || value;
}
}