@bedrockio/yada 1.0.35 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/messages.js +5 -2
- package/package.json +1 -1
- package/src/messages.js +3 -2
package/dist/cjs/messages.js
CHANGED
|
@@ -8,7 +8,7 @@ var _errors = require("./errors");
|
|
|
8
8
|
var _localization = require("./localization");
|
|
9
9
|
function getFullMessage(error, options) {
|
|
10
10
|
const {
|
|
11
|
-
delimiter
|
|
11
|
+
delimiter = '\n'
|
|
12
12
|
} = options;
|
|
13
13
|
if (error.details) {
|
|
14
14
|
return error.details.map(error => {
|
|
@@ -41,11 +41,14 @@ function getInnerPath(error, options) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
function getLabeledMessage(error, options) {
|
|
44
|
+
const {
|
|
45
|
+
type
|
|
46
|
+
} = error;
|
|
44
47
|
const {
|
|
45
48
|
path = []
|
|
46
49
|
} = options;
|
|
47
50
|
const base = getBase(error.message);
|
|
48
|
-
if (path.length) {
|
|
51
|
+
if (type !== 'custom' && path.length) {
|
|
49
52
|
const msg = `{field} ${downcase(base)}`;
|
|
50
53
|
return (0, _localization.localize)(msg, {
|
|
51
54
|
field: getFieldLabel(options)
|
package/package.json
CHANGED
package/src/messages.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isSchemaError } from './errors';
|
|
|
2
2
|
import { localize } from './localization';
|
|
3
3
|
|
|
4
4
|
export function getFullMessage(error, options) {
|
|
5
|
-
const { delimiter } = options;
|
|
5
|
+
const { delimiter = '\n' } = options;
|
|
6
6
|
if (error.details) {
|
|
7
7
|
return error.details
|
|
8
8
|
.map((error) => {
|
|
@@ -34,9 +34,10 @@ function getInnerPath(error, options) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function getLabeledMessage(error, options) {
|
|
37
|
+
const { type } = error;
|
|
37
38
|
const { path = [] } = options;
|
|
38
39
|
const base = getBase(error.message);
|
|
39
|
-
if (path.length) {
|
|
40
|
+
if (type !== 'custom' && path.length) {
|
|
40
41
|
const msg = `{field} ${downcase(base)}`;
|
|
41
42
|
return localize(msg, {
|
|
42
43
|
field: getFieldLabel(options),
|