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)

7
votes
2answers
441 views

Servlet file uploader

I think this code looks ugly, especially with the multiple try-catch blocks, but I don't know how to rewrite it: ...
5
votes
1answer
64 views

Avoiding code repetition while handling exceptions

For my application, I need to use two slightly different algorithms for persisting an entity: ...
3
votes
1answer
26 views

Netscape bookmark file generator

I started to learn Rust some time ago and I wonder if there is some way to write Rust code that is both concise and safe — in particular, avoiding unwrap(), casting ...
4
votes
2answers
47 views

Property file loader

I have the following code: ...
4
votes
2answers
68 views

Printing gitignores

I have written a simple program in Java 7 to write the .gitignore of different file types: ...
2
votes
2answers
47 views

Root-finding by iterated bisection

Both of the following code give the same result. But I'm not sure where should I put the raise statement. ...
2
votes
2answers
86 views

Load text file into an array in Swift

I'm drowning in Swift optionals and error handling syntax. I'm just converting a text file into an array of Strings. One would think that this could be a simple two or three liner but by the time I ...
10
votes
1answer
127 views

C++ alternative to exceptions

I've been thinking about error handling in C++ lately. Exceptions are a great way of handling errors in most applications. However, I work in the games industry where it is commonly accepted that ...
0
votes
1answer
38 views

JUnit test case to check that an exception of type javax.mail.MessagingException is not thrown

I have a method which will send a text mail using JavaMail API and I am trying to write a test case for this method which will check if an Exception of type ...
2
votes
4answers
88 views

Getting LinkedIn details

Each field is prone to throw an exception if not found. If one element not found, then the next should be checked. I have put each element in a separate try/catch. Is this a correct approach or can it ...
2
votes
0answers
17 views

Test web application

I am writing a test web application in Golang. Create post handler: ...
1
vote
0answers
30 views

Dynamically created Exception classes

This is a question about best practices. I have a project I am building and I have the following base Exception class: ...
0
votes
1answer
29 views

Class and Static practice, IDS and a max instance count [closed]

I was practicing working with classes and the static property included with them and came up with a simple ID counter and max number list. I also added a quick debug error ...
10
votes
2answers
225 views

Memoizing decorator that can retry

I have some tasks that I'd like to memoize because they connect to a rather slow network and have to wait for the data. Unfortunately this network can be a little finnicky and we get occasional ...
3
votes
1answer
38 views

Catch all checked exceptions and turn into unchecked exception

I am currently trying to learn Lambdas and following the book Java SE8 for the really Impatient and just finished Chapter 1 of it. This is the question, I am trying to get done with: Didn’t you ...
4
votes
2answers
57 views

Handling request errors in snap with haskell

I'm currently taking a look at Snap with Haskell. I'm pretty new to Haskell and functional programming in general and am working out the best way to handle errors. Currently I have something like this ...
11
votes
2answers
253 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
54 views

Raise, handle and note down the custom exceptions [closed]

I am creating a custom Exception class and trying to log the CallerFilePath, ...
13
votes
6answers
523 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
47 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 ...
1
vote
4answers
67 views

Python Decorator - inspecting function argument values

Some of my functions use a "fail_silently" flag. It is used in the following way: ...
2
votes
1answer
168 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
83 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
80 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
507 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
73 views

Logging mechanism

I have the following code: ...
2
votes
1answer
49 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
95 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
34 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
104 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
34 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
83 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
37 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
52 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
373 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
184 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
83 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
84 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
443 views

Inline error checking in VBA

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
81 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
737 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
155 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
46 views

Logging out using nested promises

Is it OK to do that ? for example, I have my log out service ...
2
votes
0answers
46 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
97 views

Accessing value from either os.environ or argparse

I have the following code: ...
12
votes
1answer
155 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
61 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
43 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
122 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 ...