I have the following code I need to pass a dynamic value (for eg - Message: 'DP' Missing stamp in the header)
In Error object with the Message field, i need to add dynamic value. What is the correct way to pass dynamic values?
var Error =
{
value:
[
{ Code: 'Error1', Message: "Missing stamp in header" }
]
}
function ErrorCode(erCode) {
var err = serviceErrors.errors.filter(function (er) {
return er.Code == erCode
});
}
function validateRequestHeaders(req) {
var Error = { value: [] };
return new Promise(function (resolve, reject) {
if(req.header("stamp").toLowerCase() !== 'dp'){
Error.value.push(ErrorCode("Error1"));
}
}
resolve(Error);
})
}