error management
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user