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.

-2
votes
0answers
18 views

std::variant for error types [on hold]

I'm currently in the process of rewritting a http-client class. When it comes to the error-handling I see the three options: Throwing an exception Passing an error-type by reference Returning a ...
-4
votes
0answers
17 views
2
votes
1answer
67 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
34 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
543 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
26 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
80 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
155 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
87 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 ...
0
votes
0answers
28 views

Pattern to ensure only valid Positions are created, in as easy a way as possible

In the game engine that I'm creating, I have a Position Service. This service is the single authority of what is or isn't a valid position in the world. A goal of mine for this project is to make it ...
4
votes
1answer
49 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
43 views
0
votes
1answer
40 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
40 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
72 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
65 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
101 views

WebAPI global exception handler

There is a global exception handler in our WebAPI application that looks like the following: ...
5
votes
2answers
452 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 ...
0
votes
2answers
27 views
1
vote
1answer
48 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
73 views

Retry Class in Java

I have the following Java code used to retry a certain actions/methods ...
1
vote
0answers
37 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
46 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 ...
0
votes
0answers
24 views

Kotlin MVP design suggestion

I have implemented simple design for error-handling in MVP architecture in Kotlin language, but I'm not sure if it is poor or good design. My main idea was to transfer exceptions directly to functions ...
3
votes
1answer
95 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 ...
0
votes
1answer
44 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
76 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
57 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
65 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
86 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
73 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
36 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 ...
5
votes
3answers
803 views

Should I avoid try-catch implementation in ASP.NET Web API?

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
148 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
608 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
90 views

Representing multiple errors in Go

The MediaWiki API may return multiple errors. Is this a idiomatic way of representing them? ...
13
votes
3answers
1k 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
25 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
108 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
41 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) ...
3
votes
2answers
1k views

“Always stay connected” mechanism for socket connection

I'm calling Connect() for the first time I connect, I am then checking if the connection is still connected every 10 seconds if it is not connected it attempts to ...
2
votes
0answers
48 views

Catching exceptions arised by different senarios and handle them differently [closed]

I am learning exception handling in java. Every time I am writing a function, I wonder if I should put the entire function code in a try catch block. What the function does: In the below function, i ...
4
votes
1answer
66 views

Resource closing in a promise chain

This is some code that fetches a result from a database. It connects, makes a query, processes the query, then has to close the DB (under all possible code paths) and return the result. It seems ...
6
votes
2answers
100 views

Automated document downloading, with error handling

I've automated downloading of CSVs from our vendors' websites. As expected with anything web-based, things can go... wrong, so I'm implementing some better error handling. The code has been working ...
3
votes
1answer
94 views

Generating a unique reference number for logging purposes in a custom exception

I've come up with a base class for exceptions for this SMS-based service I am working on. The basic idea behind the service is that a user sends a text message to a number, the message requests a ...
1
vote
1answer
86 views

Monkey-patching Jasmine's it() function to log errors

The introduction of async native support in Jasmine doesn't log the errors (i.e., specific line number where the error occurs) to the console. So, to get around this behavior and to make the errors ...
1
vote
4answers
578 views

Correct using of try/catch clause on database execution

When a statement to a DB returns null, I am catching it this way: ...
2
votes
1answer
42 views

Creating a presigned URL

I've created software in Go to create a presigned URL: ...