News for hackers. Stuff that matters.
Re:You’re better off using Exceptions by Seenso on Monday February 03, 2020 @12:52PM (#22226789)
> 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');
  }

There are no comments on this comment yet.