File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 11import { type TFunction } from 'i18next'
22
33export default class IpldExploreError extends Error {
4+ // translation key to prevent minification issues
5+ readonly translationKey : string
6+
47 constructor ( private readonly options : Record < string , string | number > ) {
58 super ( )
6- this . name = this . constructor . name
9+ this . translationKey ?? = this . constructor . name
710 }
811
912 /**
@@ -17,8 +20,19 @@ export default class IpldExploreError extends Error {
1720 * t('NameOfErrorClassThatExtendsIpldExploreError')
1821 */
1922 toString ( t : TFunction < 'translation' , 'translation' > ) : string {
20- return t ( this . name , this . options )
23+ const translationKey = this . translationKey ?? this . name
24+ return t ( translationKey , this . options )
2125 }
2226}
2327
24- export class BlockFetchTimeoutError extends IpldExploreError { }
28+ export class BlockFetchTimeoutError extends IpldExploreError {
29+ readonly translationKey = 'BlockFetchTimeoutError'
30+ }
31+
32+ export class BlockFetchError extends IpldExploreError {
33+ readonly translationKey = 'BlockFetchError'
34+ }
35+
36+ export class CidSyntaxError extends IpldExploreError {
37+ readonly translationKey = 'CidSyntaxError'
38+ }
You can’t perform that action at this time.
0 commit comments