News for hackers. Stuff that matters.
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever by andrekandre on Thursday July 13, 2023 @06:50PM (#36717168)
this is a very common in obj-c too

on the other hand, depending on what your trying to do you might want to provide more context about what happened to the user/programmer

in swift you can change a throwing function to a nullable with `try?` so even if `getUser()` throws, you can keep it simple if thats what is appropriate

  guard let user = try? getUser(id: someUUID) else {
      return "user not found"
  }
as an aside, swift "throws" exceptions but these are just sugar for returning basically an Result<T,E> and compose much better than traditional stack unwinding exceptions imo

There are no comments on this comment yet.