Why doesn't set -e stop my function when I call it from an if?
A cleanup function runs a failing command and then prints a success message. With set -e enabled, calling the function as an if condition still reaches the success…
A cleanup function runs a failing command and then prints a success message. With set -e enabled, calling the function as an if condition still reaches the success…
I'm writing a Bash script to create a full snapshot of several source directories in a timestamped backup directory. For now, I'm fine with hard-coded paths. The script…
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 have several Bash functions that install Docker, Docker Compose, Git, and jq. Each function repeats argument-count checks, empty-value validation, boolean validation, debug logging, and error handling. The…
I maintain a PowerShell module with about 40 exported provisioning functions. I recently reviewed all 127 places where those functions report or handle errors: 52 used string-based throw,…
I maintain a PowerShell module with roughly 40 exported provisioning functions. After auditing 127 error paths, I found four different behaviors: 52 used throw with a string, 34…
I'm a second-year computer science student and have been teaching myself Go for about a month. During that time, I built Chronos, an AI-powered personal scheduler. It combines…
I'm a second-year computer science student who has been learning Go for about a month. During that time, I built Chronos, an AI-powered personal scheduler. It combines fixed…
I'm fairly new to Bash scripting and am trying to tidy up a personal backup script. It creates date-stamped tar.xz archives from several folders, then transfers them to…
I'm new to Bash scripting and I'm working on a personal backup script. It accepts up to four arguments, such as "essentials", "archive", and "paperwork". For each selected…
I have a workflow that starts with GetDataLambda, which retrieves data needed by two independent processing paths. After that task completes, I want to run these branches in…
I'm pulling pricing data from a REST API for a small side project. Most responses are JSON, but the structure is inconsistent: fields may be missing, arrays can…
I have a Bash script that may either be executed directly or sourced into the current shell. When it finishes, I need it to use `return` in the…
I'm pulling pricing data from a REST API for a small side project. Most responses are JSON, but the API sometimes omits fields, returns empty arrays, or sends…
I'm new to PowerShell and am trying to write a retry function that accepts a script block, the number of attempts, a delay between attempts, and an operation…
I'm writing a PowerShell script that searches devices through an MDM platform. Because the API requires a separate request for each device, processing more than 1,500 systems sequentially…
I'm working on a Bash script that includes a function called `test_command`, which executes a command passed to it and checks whether it completed successfully. I'm wondering about…
I have a Bash script running on AWS EC2 that orchestrates a PostgreSQL dump using Docker. It works fine when everything goes smoothly, but if something failsโlike if…
Hey everyone! I'm a junior developer trying to understand how Python and Go handle special cases when functions return values. I've noticed that Python functions often return a…