My Apex controller method might throw a custom exception
@AuraEnabled
public static Id myAction() {
// Provoke exception
Integer foo = 10 / 0;
and I want the toast to display it properly
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
title: 'Error',
type: 'error',
message: response.getError()[0]
});
toastEvent.fire();
Instead of my the string I passed into my custom exception I get this! What am I doing wrong?
AuraHandledException
instead of your own apex classAuraHandledException
is not an abstract or virtual class, so it can't be extended.