4 ms·
> I'll let people decide which one is better. I personally prefer the first one. That's JavaScript, right? That's probably not the best language to use to jud
by Seenso 7y ago
> I'll let people decide which one is better. I personally prefer the first one.
That's JavaScript, right? That's probably not the best language to use to judge the concept of exceptions.
It's cleaner in languages like Java:
try {
Record record = store.findRecord(params.id);
render(record);
} catch(RecordNotFoundException e) {
render('record-not-found');
} catch (Exception e) {
render('unexpected-error');
}