Update user friendly errors for translations (#15000)
Force msg typing instead of string for user friendly errors
This commit is contained in:
+9
-2
@@ -14,8 +14,15 @@ describe('formatConnectRecordNotFoundErrorMessage', () => {
|
||||
expect(result).toEqual({
|
||||
errorMessage:
|
||||
'Expected 1 record to connect to connectFieldName, but found 0 for field1 = value1 and field2 = value2',
|
||||
userFriendlyMessage:
|
||||
"Can't connect to connectFieldName. No unique record found with condition: field1 = value1 and field2 = value2",
|
||||
userFriendlyMessage: expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
message:
|
||||
"Can't connect to {connectFieldName}. No unique record found with condition: {formattedConnectCondition}",
|
||||
values: {
|
||||
connectFieldName: 'connectFieldName',
|
||||
formattedConnectCondition: 'field1 = value1 and field2 = value2',
|
||||
},
|
||||
}),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { msg } from '@lingui/core/macro';
|
||||
|
||||
import { type UniqueConstraintCondition } from 'src/engine/twenty-orm/entity-manager/types/relation-connect-query-config.type';
|
||||
|
||||
@@ -13,6 +13,6 @@ export const formatConnectRecordNotFoundErrorMessage = (
|
||||
|
||||
return {
|
||||
errorMessage: `Expected 1 record to connect to ${connectFieldName}, but found ${recordToConnectTotal} for ${formattedConnectCondition}`,
|
||||
userFriendlyMessage: t`Can't connect to ${connectFieldName}. No unique record found with condition: ${formattedConnectCondition}`,
|
||||
userFriendlyMessage: msg`Can't connect to ${connectFieldName}. No unique record found with condition: ${formattedConnectCondition}`,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user