Are try-catch blocks really bad practice?
I'm new to programming, and my boss recently called try-catch statements "garbage" and told me to avoid them completely. That confused me because I thought exceptions were a…
I'm new to programming, and my boss recently called try-catch statements "garbage" and told me to avoid them completely. That confused me because I thought exceptions were a…
I'm new to programming, and my boss told me that try-catch statements are "garbage" and that I should avoid them entirely. That confused me because I thought exceptions…
I'm learning Java and trying to understand how Thread.sleep(1000) works in this loop. The code updates a progress bar, pauses for one second, and catches InterruptedException if the…
I'm learning Java and trying to understand what happens when I call Thread.sleep(). In this loop, the progress bar is updated and then the current thread pauses for…
Suppose main() is frame 1 and the method that ultimately throws the exception is frame 10. Java prints a trace like this: message for 4 4 3 2…
Suppose main() is frame 1 and the method that ultimately throws the exception is frame 10. Why does a stack trace print the exception message followed by frames…
I'm writing a Python program with a failsafe function that should stop execution if something goes seriously wrong. I'm currently considering using sys.exit() for a normal shutdown and…
I'm writing a Python program and want a failsafe that stops execution if something serious happens, ideally before further processing can corrupt data. I currently have a function…
I'm building an import feature that may process millions of CSV records in background batches. The user should receive a notification when the import finishes, but I'm unsure…
I'm building an import feature that may process millions of CSV records. The work runs in the background in chunks, and users are notified only when the import…
I'm trying to understand the purpose of assertions. They're often described as checks for conditions that must always be true, but an if/else statement or an exception can…
I'm writing a small Python program and need to choose a Desktop directory. Right now I'm checking whether `Path.home() / "Desktop"` exists, and otherwise falling back to `Path.home()…
Recently, my boss told me that using try-catch statements is "garbage" and that we should avoid them in our development work. He didn't specify any programming language, so…
Have any of you found that exception chaining makes it easier to identify bugs in your code? I'm curious if you've had experiences where it really helped clarify…
I'm working on a Python method that has some code below a finally block, and I'm curious if that code actually gets executed. My IDE (PyCharm) is giving…
I'm looking for advice on how to handle exiting a Bash script in a graceful way. Specifically, when I press `ctrl + c`, my script only exits the…