Skip to content

Commit d13324a

Browse files
committed
Change error message to look more like it did before
1 parent ada4ca6 commit d13324a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function formatError(req, h) {
135135
}
136136

137137
function getJoiErrorMessage(details) {
138-
return `Validation error: ${details.message} (${details.path})`;
138+
return `Validation error: ${details.message} (${details.path.join('.')})`;
139139
}
140140

141141
/**

test/index.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('JSON API Plugin', () => {
3333
});
3434

3535
const res = await server.inject({method: 'POST', url: '/test', payload: {fo: {}}});
36-
assert.equal(res.result.errors[0].details, 'Validation error: "bar" is required (fo,bar)');
36+
assert.equal(res.result.errors[0].details, 'Validation error: "bar" is required (fo.bar)');
3737
});
3838
});
3939

0 commit comments

Comments
 (0)