310
submitted 7 months ago by ilost7489@lemmy.ca to c/196@lemmy.blahaj.zone
top 7 comments
sorted by: hot top controversial new old
[-] ImplyingImplications@lemmy.ca 31 points 7 months ago

I wrote a small command line program that would crash if a keyboard interrupt was used to close it. I fixed the crash by catching the keyboard interrupt exception...but I couldn't do anything with it. The keyboard interrupt closes the program. Catching the interrupt only stopped the crash message from appearing. So my code basically looked like this.

[-] quinkin@lemmy.world 25 points 7 months ago

Throw(e)

Make your problem someone else's problem.

[-] jbk@discuss.tchncs.de 2 points 7 months ago

Wrap it in a RuntimeException and the compiler will be happy to.

[-] PM_ME_VINTAGE_30S@lemmy.sdf.org 17 points 7 months ago
[-] wander1236@sh.itjust.works 9 points 7 months ago

That formatting, on the other hand, is not going away

[-] SmoochyPit@beehaw.org 6 points 7 months ago

very true ๐Ÿ˜ค๐Ÿ‘

[-] splitz@lemm.ee 3 points 7 months ago

Much like teeth โ€ฆ and friends

this post was submitted on 07 Mar 2024
310 points (100.0% liked)

196

16410 readers
2319 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS