summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/i18n/translations/errors/userAlreadyExistsError.ts15
-rw-r--r--src/types/UserAlreadyExistsError.d.ts8
-rw-r--r--src/types/UserAlreadyExistsError.ts13
3 files changed, 28 insertions, 8 deletions
diff --git a/src/i18n/translations/errors/userAlreadyExistsError.ts b/src/i18n/translations/errors/userAlreadyExistsError.ts
new file mode 100644
index 0000000..cb95153
--- /dev/null
+++ b/src/i18n/translations/errors/userAlreadyExistsError.ts
@@ -0,0 +1,15 @@
+import type { TranslationsDictionary } from '$types/TranslationsDictionary';
+
+const tPage = {
+ message: {
+ sco: ({ userId }: { userId: string }) => `
+ There’s else a user wi the ID ${userId}.
+ `,
+ 'en-GB': ({ userId }: { userId: string }) => `
+ A user already exists with the ID ${userId}.
+ `,
+ },
+};
+
+type Raw = typeof tPage;
+export default tPage as TranslationsDictionary<Raw>;
diff --git a/src/types/UserAlreadyExistsError.d.ts b/src/types/UserAlreadyExistsError.d.ts
deleted file mode 100644
index 33ad8fc..0000000
--- a/src/types/UserAlreadyExistsError.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-class UserAlreadyExistsError extends Error {
- constructor(userId) {
- super(`A user already exists with the user ID ${userId}.`);
- this.name = 'UserAlreadyExistsError';
- }
-}
-
-export default UserAlreadyExistsError;
diff --git a/src/types/UserAlreadyExistsError.ts b/src/types/UserAlreadyExistsError.ts
new file mode 100644
index 0000000..787d639
--- /dev/null
+++ b/src/types/UserAlreadyExistsError.ts
@@ -0,0 +1,13 @@
+import type Locale from './Locale';
+
+import translate from '$i18n/translate';
+import tError from '$i18n/translations/errors/userAlreadyExistsError';
+
+class UserAlreadyExistsError extends Error {
+ constructor(userId: string, locale: Locale) {
+ super(translate(locale)(tError, { key: 'message', userId }));
+ this.name = 'UserAlreadyExistsError';
+ }
+}
+
+export default UserAlreadyExistsError;