Skip to content

Commit 93975c0

Browse files
committed
fix error validation
1 parent f9c308c commit 93975c0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

components/kustomer/common/utils.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export const parseObject = (obj) => {
2828
export const throwError = (message) => {
2929
const parsedMessage = JSON.parse(message);
3030
const error = parsedMessage.errors[0];
31-
const errorParameter = error.meta.subErrors[0].source.pointer || error.source.parameter;
32-
const errorMessage = error.detail || error.meta.subErrors[0].title;
31+
const errorParameter =
32+
error.source.parameter ||
33+
error.source.pointer ||
34+
error.meta?.subErrors[0]?.source?.pointer;
35+
const errorMessage = error.detail || error.title || error.meta?.subErrors[0]?.title;
3336
throw new ConfigurationError(`${errorParameter} - ${errorMessage}`);
3437
};

0 commit comments

Comments
 (0)