Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Used typed throws for a bit and I like them. I remember from long ago the Java implementation forcing me to catch them but in Swift it’s just a bit of extra compiler-enforced documentation about what and what not to expect in terms of errors.


> I remember from long ago the Java implementation forcing me to catch themm

“throws Exception” on your method.


*on all methods

And then in main:

    try {
      // whatever
    } catch (Exception e) {
      System.out.println("Oops!");
    }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: