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.

learn more… | top users | synonyms (1)

0
votes
3answers
14 views

Opening and validating an XML file

I have a section of code that repeats many lines and I am looking to refactor this code possibly so that a function can be used instead of the same lines of code each time. Below is the section of ...
11
votes
3answers
1k views

Prompting for two integers and dividing, using exceptions to handle divide-by-zero errors

I'm trying to learn exception handling in C++. I wanted to read two integers and divide them and print them. The code should throw an exception when the second integer is zero, ask the user to re-...
1
vote
2answers
103 views

Raising error or returning None [closed]

I have a method poker defined as below: ...
1
vote
2answers
40 views

Reinitialize cache periodically, catching and logging any Throwables

My existing code has a scheduler that we init when a DataStore constructor is called. ...
5
votes
2answers
232 views

Send records and retry them if acknowledgement is not received

I am working on a project where I need to consume lot of records and then I am sending these records to some other system which uses zeromq. Here is the flow: Store all the incoming records in a CHM ...
2
votes
1answer
57 views

Filtering out the correct car from a list of cars and retrieving only one car

I am filtering out a List<Car> based on the brand. Since each car is made by one brand, I want to make sure my method ...
0
votes
1answer
35 views

Monitoring errors with singleton

I need to monitor my functions for "errors" and want to print the warnings at the end of the functions. I thought using singleton class could be a good idea in here (code inspired by this example): <...
0
votes
1answer
86 views

URL decode a string but log an error after second exception

I have a method which does URL decoding on the string value passed along with using Charset: ...
7
votes
0answers
71 views

Simple C++ alternative to exceptions for embedded systems

I have researched ways to implement a simpler alternative for C++ exceptions. The problem I had with exceptions was the complex and not-portable stack unwinding process which make him hard to ...
5
votes
1answer
78 views

Circular doubly linked list with templates

I tried to write some code namely "Circular doubly linked list" and I would like to use templates to do this. This is the first time I use templates and throws some exceptions. I would like to know ...
5
votes
2answers
105 views

Find all words that can create a pyramid

I wanted to write something that would find all pyramid words within a supplied text file or list of strings. An example of a pyramid word is the word "deadheaded". It has one of the letter "h", two ...
3
votes
1answer
1k views

Are these try/catch blocks cluttering the code?

The following program reads a stream and creates a two dimensional std::vector. I'm trying to find an elegant way to handle the errors and recover from them as ...
0
votes
1answer
75 views

PHP Error Class

I have coded a very simple error class that will allow me to display errors if they should happen. For example, if a file is missing or a database connection couldn't be established I would display a ...
4
votes
1answer
456 views

Verifying user accounts on SMTP servers

I've been writing a basic script to enumerate SMTP users (via a user dictionary) on poorly configured SMTP servers. In scripts like this, I usually see arguments handled as follows: ...
1
vote
3answers
85 views

Select a list from a 2D list, take the last item from its nearest non empty left neighbour and put it at its head

I've just got into Haskell a few days ago and I love it. I'm looking for some pointers and best practices on how to organise and write Haskell code specifically when it comes to managing errors, which ...
3
votes
1answer
106 views

Dual-language beginner math solver program in C++

I've written a program that solves questions of: Addition Finding the hypotenuse of a triangle Checking if the triangle has a right-angle or not I've also written it to be viewed in English or ...
6
votes
2answers
67 views

Repeat an action for a set of elements until all succeed, or progression halts

Context I'm trying to write a function that drops a list of tables from a database (e.g., tables A, B and C). This function has the following type, it returns a list of booleans indicating whether ...
3
votes
1answer
110 views

Try again, and again, and again… but not too often because the potatoes won't grow

The delay sequence has been fixed so I can move to the next step which are the Retry and Breaker. (Just ignore the console ...
5
votes
2answers
417 views

An attempt to make a linked list iterator “safe”

I was practicing my C++ routine and decided to code up this simple linked list data structure. Furthermore, I made an attempt to make the list iterator "safe" in the sense that it throws an exception ...
5
votes
1answer
24 views

Interpreting database values as times and integers

I am working through Chapter 10 of Haskell Programming from First Principles. I've gotten the code to work, but I am uneasy about the fact that a few of my functions - namely, ...
3
votes
1answer
168 views

AngularJS recursive function call with $timeout

I have created a recursive function call in AngularJS and just wonder if is there a better way to solve this problem? The code works perfectly. My code is the following: ...
2
votes
1answer
115 views

Concurrent/parallel ForEachAsync - proper handling of exceptions and cancellations

I've created an asynchronous parallel ForEach mechanism so I could enumerate an enumerable by N degrees of concurrency and process an action for each item. ...
1
vote
1answer
33 views

Prettifying PHP's Exception stacktraces

I have always disliked the way PHP printed stacktraces, coming from a Java world. So I decided to implement my own ExceptionFormatter, a class that will format ...
6
votes
1answer
68 views

X86 Legacy boot loader error trapping

The boot loader that I'm designing is just simply going to setup (A) Stack, (B) Segment registers (C) Load remainder of track for specified device. Conventionally, this could have been up to 4 floppy ...
1
vote
0answers
92 views

Django REST custom methods for generic views

I'm intern and work on a project where I develop DRF API that need to interact with mobile app written by my colleague with Ionic framework. We are creating new user. My view method is following: <...
2
votes
0answers
51 views

Waiting for all task to complete while catching exceptions early

I'm working on simulating a number of processing elements (nodes) which do some work in parallel and communicate by exchanging messages. The message exchange is not in the scope of this post, but it ...
4
votes
1answer
101 views

An object for passing a chain of errors in JavaScript

I want to pass errors in errors in order to know exactly the chain of causes, but without augmenting or even reading any stack until this becomes really necessary. And this is how I would achieve this:...
0
votes
0answers
178 views

Insert data into Aurora DB from Kinesis Stream using Amazon Web Services Lambda Function

I have a python AWS lambda function that takes JSON records, checks them to see if they have required keys, and then inserts into MySQL db. The function gets invoked whenever a new record comes into ...
1
vote
1answer
65 views

Handling errors in a Python UDP proxy [closed]

The following (stripped) program receives UDP packets on port 5000 and forwards them to port 5001. It may throw socket errors on startup (e.g.: if the port is already in use), but I am not too worried ...
4
votes
1answer
64 views

Validating attributes of a page in Adobe Experience Manager

I am reviewing the following code written by a fellow developer. I am not an java expert but IMHO i did not feel this is efficient use of exceptions — the reason I feel so is: The below code throwing ...
1
vote
1answer
127 views

Job queue with threading

On many articles and blogs, I have read that exceptions should not decide flow of your code. I have wrote the following code using one thread: ...
7
votes
3answers
140 views

Doing an ROP style bind for two functions on the same input in a pipeline

I am working on understanding Railway Oriented Programming (Scott Wlaschin style) in F#. In my example I want to create a pipeline which does some calculation, applies two different functions to the ...
3
votes
3answers
433 views

Lower level exception handling during enumeration

I've got pretty straight forward scenario. I've got a class called FileInformationExtractor and method GetFilesInformation that ...
0
votes
1answer
47 views

Handling user input - follow-up

Original code: Getting name from user, and handling any errors in C I fixed the bugs. Is there anything else to consider? ...
1
vote
1answer
53 views

Getting name from user, and handling any errors in C

The primary purpose of this program is to practice catching if the user enters data that does not correspond to expected input. Note if the user enters their name as "123", this is valid as it can be ...
2
votes
4answers
149 views

General Retry Strategy #3 with TryResult

I wanted to use the Try helper from @DmitryNogin's General Retry Strategy #2 but each attempt to implement it revealed another thing that is missing. In my review ...
4
votes
1answer
268 views

Reading lines of a file into a vector of strings

I have to read from a file and store the data inside an std::vector container. The procedure of opening the file, reading and writing onto the container are enclosed in a routine: readData. Reading ...
1
vote
1answer
64 views

Make sure the user enters a valid floating-point number in C

I would like to know if this is a good way to make sure the user enters a valid number. ...
3
votes
1answer
147 views

General Retry Strategy #2

Previous version Now supports async operations and cancellation. Let’s say we copy some file using retry strategy (it might be blocked, etc.). App code comes bellow: ...
2
votes
0answers
65 views

Rust-like “Result” in C - nicer error handling

There are frequently things I miss when using C; one of them is a nice error-handling (exception-like) system. After trying Rust, I realized I could implement something similar in C itself. So here's ...
4
votes
3answers
173 views

General Retry Strategy

Let’s say we copy some file using retry strategy (it might be blocked, etc.): ...
1
vote
0answers
85 views

REST API returning NotFound (404) if record is not found in the database

I'm not really sure what the preferred way is to deal with records not found in the database. Is it better to write a Find method which returns ...
3
votes
1answer
62 views

Avoiding a call to CommandBarControl.Picture

Earlier today, I encountered an Access Violation error when opening the VBE for SolidWorks 2006, while Rubberduck VBA was initializing. I traced the Access Violation back to an attempt to set the ...
1
vote
0answers
34 views

Functional-style Cocoa XML serializer and object mapper

I'm working on an XML-to-model-object serialization and deserialization library. There are three main design goals for the code: It should parse XML into and serialize from Cocoa-native collection ...
3
votes
1answer
170 views

Class of file uploading to S3 using boto with multipart supported

I'm writing an app by Flask with a feature to upload large file to S3 and made a class to handle this. I have some targets in writing code: Code must be easy to understand and maintain. (Yes, ...
0
votes
2answers
298 views

Check existence of item in collection [closed]

Checking whether an item exist in a collection isn't straightforward in VBA, it requires error checking and during error handling we need to clear the error and also resume code to be able to ...
0
votes
1answer
55 views

SQL message logger run loop

I am learning Java by reading source code of other authors. This Java method handles communication with SQL database. While the code does work several things concern me. For instance the ...
6
votes
3answers
102 views

Parsing excel cells containing line feed characters

This is a direct follow up to Parsing cells containing Line Feed Characters. Link to sanitized xls on dropbox if test data is needed Essentially the reports I work with aren't bad - The issue is ...
10
votes
5answers
2k views

Validation that also returns error messages

My Create, Update and Delete methods should return a ...