Compare commits

...

1 Commits

Author SHA1 Message Date
williamlardier 579bcdf08f
ARSN-193: more flexible use of error metadata 2022-05-06 12:08:34 +02:00
1 changed files with 2 additions and 2 deletions

View File

@ -118,7 +118,7 @@ const XMLResponseBackend = {
`<Message>${errCode.description}</Message>`, `<Message>${errCode.description}</Message>`,
); );
let counter = 1; let counter = 1;
const invalidArguments = errCode.metadata.get('invalidArguments') || []; const invalidArguments = errCode.metadata && errCode.metadata.get('invalidArguments') || [];
invalidArguments.forEach(invalidArgument => { invalidArguments.forEach(invalidArgument => {
xml.push(`<ArgumentName${counter}>${invalidArgument.ArgumentName}</ArgumentName${counter}>`); xml.push(`<ArgumentName${counter}>${invalidArgument.ArgumentName}</ArgumentName${counter}>`);
xml.push(`<ArgumentValue${counter}>${invalidArgument.ArgumentValue}</ArgumentValue${counter}>`); xml.push(`<ArgumentValue${counter}>${invalidArgument.ArgumentValue}</ArgumentValue${counter}>`);
@ -187,7 +187,7 @@ const JSONResponseBackend = {
*/ */
let invalidArgumentsStr = ''; let invalidArgumentsStr = '';
let counter = 1; let counter = 1;
const invalidArguments = errCode.metadata.get('invalidArguments') || []; const invalidArguments = errCode.metadata && errCode.metadata.get('invalidArguments') || [];
invalidArguments.forEach(invalidArgument => { invalidArguments.forEach(invalidArgument => {
invalidArgumentsStr = invalidArgumentsStr.concat(`"ArgumentName${counter}":\ invalidArgumentsStr = invalidArgumentsStr.concat(`"ArgumentName${counter}":\
"${invalidArgument.ArgumentName}",`); "${invalidArgument.ArgumentName}",`);