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.
-4
votes
0answers
14 views
11
votes
2answers
200 views
Returning result and error status for number type conversions
Looking for review of design strategy of using a struct to return the functional result and error status. Your experience of how my design approach may succeeded ...
-3
votes
2answers
47 views
Raise, handle and note down the custom exceptions [closed]
I am creating a custom Exception class and trying to log the CallerFilePath, ...
12
votes
6answers
469 views
Storytelling program: Gathers stories from certain popular story websites/formats and reads them aloud
Audiobooks make my life easier when I have idle ears and a mind free to wander, but something better for my eyes to do.
This program is one of my more recent efforts to allow most of the stories ...
4
votes
1answer
35 views
Handling an invalid SQL query exception
This is my DAO object that takes the Cypher query as a string, and returns a JSON representation of the graph it returns.
Because it's using a Spring JdbcTemplate ...
13
votes
7answers
1k views
Imposing a sort order on a query
I've always been told "never use goto, there's always a better way" and for the longest time I just accepted it. Lately though, I've been running into such scenarios in which I have to repeat this bit ...
2
votes
1answer
81 views
Checking for Internet connectivity on Android
I wrote this code to check an internet connection and was wondering if this is the best way to do this check.
...
4
votes
2answers
79 views
Get an integer as input and display Pi rounded to that amount of decimal places
I've been writing a program that accepts an integer as input and displays the number Pi rounded to that number. The only issue I see is the fact that the Math.Round ...
2
votes
1answer
43 views
Program simulating dictionary using file handling - part 2
This is the new version of the dictionary program which I uploaded for reviewing here.
I would be grateful if the program could be reviewed for all the points mentioned in the above link.
...
5
votes
3answers
168 views
Try catch statement in VBA using the standard VBA error handling statements
The code below is pretty self explanatory: just copy and paste it all into a module and run it, it provides a few use cases and many explanatory comments in the text. (It works but I'm interested to ...
1
vote
2answers
71 views
2
votes
1answer
42 views
Backing up two tables using SQL transactions
I'm using a transaction statement in SQL Server 2012 for the first time.
I want to insert Table1's data in Table1_Backup before ...
7
votes
1answer
82 views
Proper checked exception handling with lambda functions
I'm having trouble finding a clean way to handle checked exceptions thrown by a lambda function passed as a parameter in Java.
I'm writing a Client which will interact via RMI with a Server to play a ...
0
votes
1answer
31 views
Retry storing HTTP response into a variable until specific code
I want to keep trying to get response until its code is 200 or unknown yet. In first case it should be stored in response variable. In another case I should raise ...
10
votes
1answer
83 views
Try-except decorator for classmethods
This question is related to the Cactus Text Game Engine.
For easy error handling in Cactus, we've put together this small decorator. Essentially, the decorator wraps any class method in a ...
4
votes
1answer
29 views
Monitoring and re-establishing a PostgreSQL connection
Within a complicated Ruby project, I need to monitor the connection to a PostgreSQL database, as answered here. I use a thread for this purpose. Every few milliseconds, I invoke "consume_input" which ...
-1
votes
2answers
74 views
Creating music using the JMusic API
I'm trying to write a program that creates music, and I am using the JMusic API to accomplish this.
These are the following constants defined in JMusic that I'm using:
...
2
votes
1answer
26 views
Generating URL and status for an S3 bucket
The following program generates the S3 URL and response (status code?) for the key, provided the bucket name and if the S3 URL is a mess (wrong url), then it generates empty string as URL and error as ...
1
vote
1answer
50 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 ...
8
votes
4answers
353 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:
...
5
votes
5answers
166 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 ...
8
votes
1answer
77 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
61 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
399 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
...
3
votes
1answer
58 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
663 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
136 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
41 views
2
votes
0answers
37 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
66 views
12
votes
1answer
148 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
60 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
77 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
63 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
266 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
70 views
Throwing exceptions in a database wrapper
I hope the extension methods ThrowArgumentNullExceptionIfNullOrEmpty and ThrowNullReferenceExceptionIfNullOrEmpty are ...
6
votes
1answer
178 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
87 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
249 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
105 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
20 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
105 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
315 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
48 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
32 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
69 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
107 views
Searching for an account by accountId
I have a piece of code that is fetching account objects from a service
...
2
votes
2answers
134 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 ...