Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [error-handling]

The various techniques used for maintaining stable program state in circumstances that, if not taken care of ("handled"), could cause serious issues, including logical bugs and abrupt execution termination.

0
votes
0answers
10 views

Lock file and interrupt signals in POSIX shell script running indefinitely

This script is running indefinitely as the Linux background process. I have put an enormous effort to make this POSIX shell script containing an infinite loop shut down tidily along with the ...
3
votes
2answers
79 views

Function to call a list of callables with retry

This script is designed to be run via windows task scheduler once per day. All callables passed to this function should only return a bool. The callables are called until either the maximum number of ...
0
votes
1answer
26 views

Using foldl to add numbers, while validating that they are nonnegative

I have a function that will calculate the sum of a list of integer, however if any of the number is negative, it will should an error instead (not throwing exception). The following is a working ...
1
vote
0answers
25 views

Error handling for an Erlang 2D point class

I am working on a math library for an online game. I want to prevent as many errors as possible and I want to catch all errors as early as possible to simplify debugging in the long run. However, I ...
1
vote
1answer
60 views

Quicksort in C with unit testing framework

This is my quicksort There are many like it but This quicksort is mine. So, quicksort, in C, with a big framework to test it six ways from Sunday. Passed the tests nicely, but there may be warts, or ...
1
vote
0answers
72 views

Controller method to add a folder to a tree [closed]

I am using the jstree to get a tree structure in my MVC application. I am actually on showing javascript errors, when something is wrong. In this case, returning an alert to Javascript. Furthermore I ...
0
votes
2answers
36 views

Printing the status of a database insertion as JSON

The controller is currently inserting a record into the database and returning a JSON response as shown below in the try-catch block. I can see the ...
2
votes
0answers
54 views

Historical exchange rate between currencies using Ecbxrate

I tried writing a simple python script using the python module ecbxrate that outputs to a CSV file a table with the daily exchange rate between EUR and USD since ...
4
votes
2answers
313 views

Reading SQL query from a resource, with error logging

I've created a utility class that expects a logger to be passed at a method level, since I prefer legitimate errors to be written out for troubleshooting later on. Another developer hates passing the ...
0
votes
1answer
157 views

Extension method to to run any async method synchronously

Sometimes I need to call async code from a synchronous method. This leads to repetition in code to wait for the task to complete, then ensure that the expected ...
8
votes
1answer
280 views

A simple ascii progress bar

I've been wanting to experiment with a bit of error handling and robustness to make my code more user friendly. I was inspired by this answer on UX to try and add a progress bar to a button - but was ...
2
votes
1answer
29 views

Testing a probabilistic prime-testing algorithm that may fail

I have implemented Pollard's Rho algorithm in Java. Due to the nature of it there is a small chance for it to fail (have not seen it happening yet). Since I do not ...
2
votes
1answer
72 views

Simple but important function to check and retry given action's result

What I'm trying to achieve is Given a predicate function and an action which returns the object to check, check predicate, retry and fail after numTries .. or success . Purpose of this function ...
-1
votes
1answer
41 views

#Error Handling- Propagating errors to calling function.

Im new to javascript programming and i am required to make a web app. Node.js will be used as the js runtime environment. In order to minimize the amount of time needed for debugging as the app ...
5
votes
3answers
951 views

An exception-safe wrapper for std::stoi

std::stoi may throw exceptions so it needs to be surrounded by try/catch. In applications where std::stoi may be used ...
3
votes
1answer
36 views

Script to clean up old files that should only run one instance

I'm writing a bash script for deleting old files on a Linux server. Here are some relevant facts about this script: As currently written, it does work as expected. However, it's entirely possible ...
1
vote
2answers
83 views

Function to map letters to numbers

I have a method that converts characters to numbers. It expects a single alphabetical character and returns the equivalent number. For example, if A is provided it returns 1, for B it returns 2. If an ...
3
votes
1answer
331 views

Error-Handling Class and Logging for VBA

I've been reusing an error class in Excel VBA projects for a few years now and I'd like to see if there are ways to improve it. Any suggestions for style, code, etc. are all welcome. The 2 ...
1
vote
1answer
129 views

Error-Handling Class and Logging

I am relatively new to C# and would like to see if what I have been using for my exception handling, message and logging is along industry standards. I have created a simple class for the Error ...
4
votes
1answer
56 views

Simple API call to get geo info and exception handling with call limiting to 50 request per hour in Python

I'm looking for a code review of this python I wrote - this code reads the zipcode column value from csv and calls the api and brings back lat, lng, state and city info. It works fine and gives me ...
1
vote
1answer
45 views
0
votes
1answer
42 views

Logging util with static lambda function

So again, I am a bit confused about some notes that i'am getting from my reviewer. I have some kind of utils, to print/prepare log messages. Yea, maybe I am a bit fanatic java 8 lambda guy but I think ...
1
vote
1answer
45 views

Generic error handler function for POSIX shell scripts

Intention I came with the idea of generic, portable, highly reliable, and further customizable function for Shell scripts, written in POSIX, for error handling. Purpose The function shall find out, ...
3
votes
3answers
81 views

Calculate total, minimum, maximum and mean from a set of distances

I have only begun to learn C++ and am reading through the book, "Programming Principles and Practices Using C++". This bit of code is my attempt to complete exercise 3 at the end of chapter 4. The ...
3
votes
1answer
82 views

Given a list of words, remove the shorter word of every pair

This is not a "please do my homework" question. I solved a problem two ways and would like to know which solution is better; better being defined by better readability, lower complexity and lower ...
2
votes
1answer
239 views

WebAPI global exception handler

There is a global exception handler in our WebAPI application that looks like the following: ...
5
votes
2answers
643 views

Custom C++ exception class with stack trace generation

I wanted to implement my own runtime error class in C++, that could provide more meaningful information on where the error occurred than std::runtime_error does. I ...
1
vote
2answers
39 views
1
vote
1answer
50 views

Spring API that performs RSA encryption with exception handling [closed]

I'm creating a rest api using Spring which utilize javax.crypto as library to do some encryption stuff. While everything works well, I'm curious whether the error handling like this is acceptable or ...
2
votes
1answer
113 views

Retry Class in Java

I have the following Java code used to retry a certain actions/methods ...
1
vote
0answers
48 views

Insert Emojis Into Outlook Email With VBA Application (For those of us who cant use add-ins)

I cannot use add ins here so I set out to create an excel application that could get the job done. I suppose that I could easily transport this into outlook? Basically I want to click one of the ...
2
votes
1answer
55 views

Displaying all application errors in a view

I'm learning ASP.NET Core with MVC pattern and I didn't find anything useful related to this argument. Actually I'm looking ...
3
votes
1answer
98 views

Running SQL Queries On A Worksheet (With Set Of Random Numbers Between 1-20 Filling Column A) Handled As An ADO

INTRO I am using an Excel worksheet as my "database." No headers so [F1] is assigned to column one by default. I filled the entire column, all 1,048,576 cells with ...
7
votes
3answers
1k views

Heap implementation for numeric types

I am trying to improve the quality of my code as well as trying to study the Heap data structure. I have implemented a minHeap (Heap in which minimum value nodes ...
-1
votes
1answer
47 views

Python client to fetch JSON data from REST API, retrying on failure

As a beginner, I'd like to see if anyone can suggest any better way of coding the below, as I'm duplicating code and nesting identical if statements as part of the following problem. I'm grabbing ...
0
votes
1answer
87 views

Mechanism to retry failed requests, with throttling

I have a simple event that the client sends to the server, the server can then respond saying if it was successful, or if it failed for some reason. The client has to send a auth code, which is ...
2
votes
2answers
59 views

Parsing date strings, inferring the year such that the date is not in the future

I got this program that I am working on and in it, I got a section that has a try statement and two error except statements. ...
2
votes
1answer
81 views

Executing arbitrary SQL statements using VBA in Excel

I built a workbook to help me extract data from a MSSQL database into Excel. I realize that this is fairly easy to do with Microsoft SQL Server Management Studio, but I can't easily get that installed ...
6
votes
1answer
114 views

Catching missing attribute errors sooner in Python using strict interface specifications

I use Python daily for long-running simulations (yes, very very optimal, I know). As you could probably guess, my coworkers and I have issues with simulations running for several minutes before ...
4
votes
2answers
104 views

Fetching data through HTTP and caching JSON result in a file

The task is to fetch some JSON data from an API with a GET request. If the location is not available for any reason, read a cache file. Otherwise write the cache file for future use. The following ...
3
votes
0answers
58 views

A tree command written in Rust - Error Handling

I am trying to learn Rust as my third main language (Coming from Java/Kotlin and Javascript/Node). For that purpose I reimplemented the Linux tree command. Not ...
6
votes
3answers
3k views

ASP.NET REST controller with try-catch error handling

Yesterday someone guided me through this article and I'm wondering whether I should use try-catch implementation or not? I have the following code below which is actually a RESTful service and I have ...
-3
votes
1answer
152 views

C++ program involving reading and displaying information from a file? [closed]

This is a program I made for practice in file handling in C++. The purpose of the program is to write three nos 1 2 and 3 into a file abc.dat and then read it and display it on the monitor. When I ...
6
votes
1answer
1k views

Using rotation of proxies within a Python script

I've written a script in Python using rotation of proxies which is able to fetch different titles from a website traversing different pages. I've tried to write this scraper in such a way so that it ...
4
votes
2answers
91 views

Representing multiple errors in Go

The MediaWiki API may return multiple errors. Is this a idiomatic way of representing them? ...
13
votes
3answers
2k views

Custom error-logging

I'm writing a static class to log my application errors into a text file. I am planning on using this as a library on any application I intend to develop in the future. Please let me know how I can ...
2
votes
0answers
26 views

Exception-safety: add cleaning up actions during the execution [closed]

I need to call some functions and clean up some resources acquired after those calls. I can't just call some determined Cleanup function in the end, because during ...
1
vote
0answers
40 views

Rendering server side errors on the client in Node/Express

I've set up a simple Node/Express service that creates new bookmarks to a database. In my Bookmark schema, one of the fields, URL, has validations. When you try to create a new bookmark without the ...
5
votes
2answers
187 views

Customizing errors based on HTTP status code in golang

I want to collect errors and its causes by defining custom errors (HTTP status 40x & 50x). For example, if user's request was bad, I want more specific reasons for the error. A customized error ...
0
votes
1answer
48 views

Using Try & Catch to solve exception [closed]

I am working on a ADDIN that works on 3D drafting program. This ADDIN has historically grown and now I am doing a big rewrite. During this rewrite I came across a issue. I have 2 (fairly similar) ...