Unable to print error message from function call

I am not a JavaScript guy (can only write simple JS function), I am trying to debug a code with the JS where my backed system is passing the correct values but I am getting an error while processing the code on the UI. Here is the JS code

this.session.onvalidatemerchant = function (event) {
        .then(function (merchantSession) {

Here is the error handling function

showPaymentError: function () {
  //showing a message on the UI

I have already verified the data being passed from my backed service is correct, I don’t see the following alter alert("jdshhdjhjdhh");. There seems to be issue with the completeMerchantValidation method but I am not sure what is the root cause for failure.I tried to change my error message with something like this

showPaymentError: function (e) {

but getitng the following output in the console *****111TypeError: Type error. Is there a way I can print the error from the completeMerchantValidation. Even tried to add try and catch around that method call but getting js compilation error

128 thoughts on “Unable to print error message from function call”