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
0answers
10 views

Beginner regex visualizer

As I start to learn regular expressions, I wrote a basic regular expression visualizer as an "introductory" project to this topic. I tried to keep MVC model, so it is consist of 3 classes: Main - ...
1
vote
1answer
36 views

Exception handling for a chain of prompts

I am trying to make an inputin() function to take all the parameters input for the first time with exception and for individual parameter for the runtime ...
0
votes
0answers
31 views

Idiomatic exception handling for socket connection [migrated]

I'm trying to understand how I can elegantly use scala.util.control.Exception package. To be more specific I want to convert this piece of Java code to functional ...
5
votes
4answers
306 views

C# PasswordService class

I am new to C# and develop a configurable PasswordService class. As the code works the next step is to improve the code. Right now there are the following options: ...
-3
votes
0answers
13 views

Python text based fantasy RPG error [closed]

I'm making a textual RPG, and I'm running into a problem. So in the code below, mobHP is a global variable, which is equal to 20000. This is only a part of the code. So what's happening is that once ...
5
votes
5answers
148 views

Map error messages to conditions

I have a method which checks some preconditions and if everything is fine returns a success response object, otherwise fail with ...
0
votes
0answers
28 views

Error management for order transactions with rollback support

I have a domain with this kind of code: ...
7
votes
1answer
55 views

RPN calculator with interactive and non-interactive modes

While writing this review, I edited the code until it became something quite different from the original. In addition to the issues I mentioned, I ended up adding features: More operators / ...
1
vote
1answer
42 views

Custom error handler for PHP

I've written a custom Error handler for use in PHP. What it does is simply capture PHP errors, and logs them using Monolog. It works, but I can't help that it has too much stuff inside. I could ...
10
votes
2answers
348 views

Handling try catch in VB6

I asked a question elsewhere on Stack Exchange and was given an answer by multiple people that checking for errors in-line was not a good practice. I have been using an ...
2
votes
0answers
24 views

Error handling for Stripe credit card processing

I have a rails application that uses Stripe for credit card processing. Currently several exceptions are being handled anywhere a transaction takes place. The code below is being used currently in 11 ...
15
votes
5answers
611 views

Populating a ListView with Items

I populate a ListView with Items. Each Item has data attached to its .Tag property. Over time, I have needed to handle many cases where something would be null or ...
5
votes
2answers
127 views

IO and Scanner exception handling

I have created a sample file reading program as an exercise while learning how to implement good exception handling. I want to ask: is this a good approach or is there some other solution that I am ...
1
vote
1answer
38 views

Logging out using nested promises

Is it OK to do that ? for example, I have my log out service ...
2
votes
0answers
30 views

Restful API for parsing records

I'm trying to implement my own API. This code excerpt should show the basic working routines. The storage is temporary an in-memory-array and the only HTTP method for now is POST. I outsourced the ...
2
votes
2answers
43 views

Accessing value from either os.environ or argparse

I have the following code: ...
12
votes
1answer
134 views

Wanted a cat. Got lolcat

Wanna learn Rust? Ya rly! I can haz FizzBuzz? No wai! Gimme /bin/cat then. But rustc say LOL! Must handle teh err0rz! Now iz ...
4
votes
1answer
56 views

Continuable if error is null

I made a method that I can use to avoid having to handle errors from callbacks. What it does is, call the passed method only if the first argument is null. So essentially it will bypass to the last ...
0
votes
1answer
37 views

Asking for a number in Java Swing

Is it good way of asking for a number? Should that function return 0 if there is an error? ...
2
votes
1answer
47 views

Playframework (Scala) custom exception handling

I am using play framework with scala and here is a scenario on which I would like to have your opinion. Let's say I have 2 ...
3
votes
1answer
48 views

Functionality for automatic retry after exception

I have made the following system to automatically retry network calls if some exception is thrown. (Earlier posted on stackOverFlow, solution inspired by what @Boris answered) ...
1
vote
2answers
242 views

Replacing thrown exception with more descriptive exception during file I/O

My code needs to open a specific file. Under certain (expected, but rare) conditions, the code will get handed a file path to a file that does not exist -- the path is expected to be otherwise valid ...
2
votes
1answer
50 views

Throwing exceptions in a database wrapper

I hope the extension methods ThrowArgumentNullExceptionIfNullOrEmpty and ThrowNullReferenceExceptionIfNullOrEmpty are ...
6
votes
1answer
174 views

LiveDate version 2

LiveDate has the ability to display the current date either by asynchronously fetching the time from a server or by just using the client system date. It's only as ...
4
votes
1answer
80 views

String find and replace method optimization

I am trying to find a specific header string from different Maps (LEDES1998Bheaders, LEDES98BIheaders and ...
6
votes
1answer
240 views

Calling other machines from the LinkedList if one is blocked or down

This is a follow on to : Simplifying asynchronous "executeAsync" method along with "onFailure" callback. I am using AsyncRestTemplate as my ...
2
votes
2answers
79 views

Users and friends query with retry, returning JSON

I am new to Azure and SQL. I have the following function that is part of a larger Web-API which is hosted on Azure and is querying an SQL Server database that is also hosted on the Azure platform: ...
1
vote
0answers
15 views

Sourcemap translator service

This is my first attempt to a serious Node.js application, I've tried to follow the async style of Node at my best, but I have several doubts and I am sure that this code can be massively improved. ...
1
vote
1answer
101 views

Validate IP address and create a registration attempt

I'm a C++/Python developer attempting to learn JavaScript, but I'm struggling to write clean code. I've read that async.waterfall and Promises are two ways to flatten the code a bit, but my ...
7
votes
3answers
284 views

Simplifying asynchronous “executeAsync” method along with “onFailure” callback

I have a system in which user id is "sharded" across all the machines which means each machine is responsible for certain user id data. I am working on a library which will take ...
2
votes
1answer
43 views

Two error-reporting conventions for a command-parser

I need to implement some function and I would like to report about a fail made inside a function. If function doesn't fail I need to get a some result (for example, ...
2
votes
1answer
30 views

Logging of various exceptions in the callback

I am working on a library in which I need to execute my URL using AsyncRestTemplate and after that I will get a json response back if it is successful. I am also making ...
0
votes
0answers
45 views

Sorting products by name or price

Lets preface this by saying that when it comes to javascript, I am a hack. I make what I need happen by cobbling together crappy, inefficient, redundant code. I want to get better. Recently I was ...
3
votes
1answer
43 views

Deciding whether an anchor should be updated

A colleague and I were discussing the following code today and had a disagreement over the return false in the ...
-1
votes
2answers
103 views

Searching for an account by accountId

I have a piece of code that is fetching account objects from a service ...
2
votes
2answers
93 views

Interfacing with instruments using pyvisa

I'm new to Python, and after running through some introductory exercises I wrote a class definition for working with some hardware, specifically a Signal Recovery model 7230 lockin amplifier. In the ...
1
vote
1answer
31 views

Logging errors with the same exception type

I wrote some code which simply retrieves the HTTP status code of the passed in URL. There are multiple potential causes of the same error. I am hoping to get some all around feedback on this code, ...
5
votes
2answers
77 views

Getting rid of goto without duplication in Go

Consider the following function: ...
1
vote
1answer
48 views

Handling all error conditions on success or failure response

I'm working on a screen where I sent a request and I get response in two types. One is success and contains the below format: ...
4
votes
2answers
113 views

Verifying value before parsing

I am writing some Java code and am coming across a try/catch block in which I decided to verify the value is not null before parsing it: ...
-1
votes
1answer
64 views

Retrying to read a file [closed]

I have a piece code which retries 3 more times to open a file (see below). Are there potential problems or side effects with the way it is written? How can it be improved? Also, why would one use ...
3
votes
1answer
136 views

Servlet responses to upload/download requests

My task is to write a program to store files in object store. One of the subtasks requires to send json or xml format response to the file uploader/downloader as requested by client. The following ...
1
vote
0answers
38 views

Sign-up controller and service

I'm programing server side node for a huge project. And I'm thinking my brains out about the best programming pattern that will be suitable for fast modification and changes. Tell me what you think ...
2
votes
2answers
392 views

Failing fast by raising an exception with a custom message

This is a script that utilizes lazy exception throwing. What I do is decorate a function that might throw an exception to throw an exception with a formatted string. ...
1
vote
0answers
33 views

Custom 503 page for MySQLi connection error

I redirect all my requests to index.php via htaccess and the code below is in my index.php. I want to ask if my code is properly set for a custom 503 page for an unsuccessful MySQLi connection trial. ...
8
votes
3answers
379 views

Exception handling and general check in Java

Are the catch statements ok or must I put in a println()? In general, is the code good-looking enough? ...
0
votes
0answers
27 views

HTTP Responce randomization

I've made some unethical code giving HTML responses at random and masking what is there for fun. It targets mainly crawlers and scripts that run through your website that are looking for ...
6
votes
2answers
473 views

Making error messages more efficient

I am using a way of making error messages, and it works fine. It is just starting to get a little annoying as my project gets larger. I was wondering if there was a way to do with with out having to ...
0
votes
0answers
46 views

Error handling in directory iterator using promises

I wrote this example of IS.File.directoryIterator for Firefox. Can you please help me to review it so if an error occurs it is caught? I'm not so great with ...
7
votes
1answer
38 views

Managing initialization for a vector abstract data type in C

As an assignment, I was to create an \$n\$-dimensional vector type for \$n \le 20\$. This vector only has to support addition and scalar multiplication. I tried to write good code, with proper memory ...