Skip to content

Commit

Permalink
Merge pull request liquality#249 from liquality/remove-translations
Browse files Browse the repository at this point in the history
fix: move translations out of error-parser
  • Loading branch information
beemi authored Nov 28, 2022
2 parents 40d3e7b + 196dd88 commit 701f506
Show file tree
Hide file tree
Showing 22 changed files with 19 additions and 852 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-avocados-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@liquality/error-parser': patch
---

fix: move translations out of error-parser - translation strings should be in the clients that use them
4 changes: 2 additions & 2 deletions packages/error-parser/src/LiqualityErrors/LiqualityError.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import randomBytes = require('randombytes');
import { JSONObject } from '../types';
import { ERROR_ID_LENGTH } from '../config';
import { PLACEHOLDER, PLAIN } from './translations/translationKeys';
import { ERROR_ID_LENGTH, TRANSLATION_KEYS } from '../config';
import { LIQUALITY_ERROR_STRING_STARTER } from '../utils';

const { PLAIN, PLACEHOLDER } = TRANSLATION_KEYS;
export abstract class LiqualityError<Context extends JSONObject = JSONObject> extends Error {
source: string;
translationKey: string;
Expand Down
8 changes: 5 additions & 3 deletions packages/error-parser/src/LiqualityErrors/ThirdPartyError.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ERROR_NAMES } from '../config';
import { ERROR_NAMES, TRANSLATION_KEYS } from '../config';
import { LiqualityError, UserActivity } from './LiqualityError';
import { PLAIN, SWAP_ACTIVITY, UNKNOWN_ACTIVITY } from './translations/translationKeys';

const { PLAIN, PLACEHOLDER, SWAP_ACTIVITY, UNKNOWN_ACTIVITY } = TRANSLATION_KEYS;

export class ThirdPartyError extends LiqualityError<ThirdPartyErrorContext> {
reportable = true;

Expand All @@ -12,7 +14,7 @@ export class ThirdPartyError extends LiqualityError<ThirdPartyErrorContext> {
this.translationKey = `${this.name}.${PLAIN}`;

if (data?.activity === UserActivity.SWAP) {
this.translationKey = `${this.name}.${PLAIN}.${SWAP_ACTIVITY}`;
this.translationKey = `${this.name}.${PLACEHOLDER}.${SWAP_ACTIVITY}`;
} else {
this.translationKey = `${this.name}.${PLAIN}.${UNKNOWN_ACTIVITY}`;
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 701f506

Please sign in to comment.