Ist es möglich, mehrere catch in J zu verwenden S(ES5 or ES6)
wie ich weiter unten beschreiben (es ist nur Beispiel):Mehrere catch in Javascript
try {
// just an error
throw 1;
}
catch(e if e instanceof ReferenceError) {
// here i would like to manage errors which is 'undefined' type
}
catch(e if typeof e === "string") {
// here i can manage all string exeptions
}
// and so on and so on
catch(e) {
// and finally here i can manage another exeptions
}
finally {
// and a simple finally block
}
Dies ist das gleiche wie wir in C#
oder in einem Java
haben.
Vielen Dank im Voraus!
Ein Block zu fangen und dann die Art der Ausnahme überprüfen? – Icepickle
@Icepickle yeap Sie haben Recht –