0

In Javascript i am catching the error and displaying it on console.log succesfully, but how can i save this error message in a variable and use it in my custom toast message ?

Code in JS : Where i am catching the error

    .catch((error) => {
  console.log('testtest error ' + JSON.stringify(error));
  this.showspinnerforfinal=false;
  this.mergeincomplete=true;
  Console.log('errormessage-->'+errormessage);
  let delay = 1700
  setTimeout(() => {
    this.mergeincomplete=false;
     }, delay );}

Code in HTML : Where i want to displaying the error message with failed message:

 <template if:true={mergeincomplete}>
  <div style="position:absolute;top:15rem;left:1rem;right:1rem;">
         <div class="slds-notify_container slds-is-relative">
             <div class="slds-notify slds-notify_toast slds-theme_default slds-box slds-box_small" style="border-color:rgb(94, 94, 97);" role="error">
             <div class="slds-align_absolute-center">
               <lightning-icon icon-name="utility:error" alternative-text="error" variant="Error" size="small" ></lightning-icon>

               <h3 class="slds-text-heading_large" style="color:rgb(94, 94, 97);">Merge not complete</h3>
             </div>
             </div>
         </div>
     </div>
 </template>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.