import { reduceErrors } from "c/ldsUtils"; //Get that component from link
try{
///whatever
} catch{
this.errors = reduceErrors(error);
this.showToast("error", "Whatever title", this.errors)
}
JS declaration
// - Toaster
showToast(variant, title, message) {
// - To use the ShowToastEvent with reduceErrors we have to join the array's values
if (typeof message === "object") {
message = message.join('
');
}
const event = new ShowToastEvent({
title: title,
message: message,
variant: variant,
mode: "dismissable"
});
this.dispatchEvent(event);
}