Frappe.throw (python) -> error: (JS) not executed, but with frappe.msgprint it is executed

Hi all,

I have a controller in Python that uses the frappe.throw function.
However in my js{

error: (r) => {
whatever code

The error function (“whatever code” above) is never executed.

If I use the frappe.msgprint(“message”, raise_exception=True) it is executed.
On the other hand, if I provide a frappe.exceptions.* exception instead of True when calling frappe.msgprint the error function is not executed.

Any idea, what I should do, if I want to use a specific exception class? frappe.msgpring always uses the ValidationError.