Tagged Questions

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)

-1
votes
0answers
9 views

Writing wrapper function and handling exceptions correctly in Python [on hold]

I am writing test scripts using Selenium Webdriver and I have created a simple framework for tests step-by-step execution. My goal was to improve the readability of the code as well as the logic of ...
1
vote
1answer
26 views

When should I call set_exception_handler with this exception handler class?

This is a simplified version of ExceptionHandler.php: ...
3
votes
0answers
39 views

Error-handling #ifdefs for AFNetworking requests

I am using AFNetworking 1.4.3 to send and receive network messages in iOS. My application works slightly differently in DEBUG and RELEASE mode, so I need to use ...
4
votes
1answer
59 views

Swift error handler for HomeKit

I have this universal error handler for my HomeKit app (currently in development). It grew out of wanting a single place to write error messages, show alerts, etc. I wanted a short, simple way to call ...
3
votes
1answer
31 views

File Exists Script Task for SQL Server SSIS

I have an SSIS package for SQL Server 2008. In this package, I need to verify that a file exists that matches a pattern of SomeFileName_*.txt where the wild card ...
3
votes
1answer
52 views

Handling errors on a web application

I have this C# production code for handling errors on a web application. There are currently two applications that use the class. In each application I initialize the class within the ...
2
votes
1answer
104 views
4
votes
1answer
47 views

Error Handling in Servlets and JSPs

I have an HTML login form that is processed by a servlet, which then redirects the user to a result page. login.jsp: ...
15
votes
6answers
1k views

Is wrapping exceptions good practice?

I have recently been refactoring some code in an effort to improve the exception handling, particularly to aid in improving the level of information given to developers during development. However I ...
1
vote
1answer
55 views

Mongoose promise & error handling

I search for rails-like way of writing NodeJS code and it's more then hard to find the right way. The code quickly become bloated and unreadable. I would like my code to be as clean as possible. ...
3
votes
2answers
521 views

Exception handling best practices

I'm actually working on a piece of code which use the following code: ...
3
votes
2answers
44 views

Haskell monad- and error-handling-style

As an answer to excersise 2.3 in Chris Okasaki's book, Purely Functional Data Structures, Inserting an existing element into a binary search tree copies the entire search path even though the ...
0
votes
1answer
58 views

Nested try/catch with PDO in PHP

I would like to know if this is the correct way to use try/catch when dealing with multiple MySQL queries and PDO: ...
0
votes
1answer
21 views

Showing a JDialog whenever there is an exception

I have made a method which I use to show the exception error through a JDialog window whenever there is one in my program. For now I can pass it either a String or ...
11
votes
4answers
775 views

Writing null-safe code to set form values

I will ask my question using the following example: HTML ...
1
vote
1answer
29 views

Error-handling in Django model-adding form

I am writing a book database, and ultimately a library system, in Django. When a book is created without a title set, the ISBN will be used to automatically fetch book data from WorldCat I have just ...
4
votes
2answers
267 views

Simple factorial program using recursion

Two concepts I realized I needed to understand and use more are recursion and Exceptions. Thus, I combined both in the following program. Although it began with a focus on using recursion it became ...
11
votes
3answers
648 views

Returning status codes from business layer

This is what I've been doing so far in my business layer to return error messages to the user. ...
3
votes
1answer
79 views

Creation of a temp file on Windows

I implemented a test that reads data from temp file on Windows. I originally had an issue that I solved with the help of this answer ...
3
votes
2answers
48 views
4
votes
3answers
175 views

Error-handling / Self-Validating mechanism

The below idea seemed to look clean, to allow the object itself to validate its values for different scenarios. For eg: While creating the object, the value of Object1 and Object2 in ...
6
votes
2answers
313 views

Generic error message factory

The purpose of this code is to centralize all error / status messages to present to the user. For example, registering an account and the user email address is already registered. A status code is set ...
0
votes
0answers
51 views

Mini eCommerce Application and Message/Warning/Error Handling

I decided to build a basic eCommerce application in C++ as a learning experience. In the past, I've gone with a fat controller, skinny model approach, and while it has worked, my results always end up ...
3
votes
1answer
42 views

Idiomatic catching of unchecked exceptions in ExecutorService.submit

OK, here's the problem space: Lwjgl, a graphical library, has the ability to throw an unchecked LWJGLException on certain methods - like ...
2
votes
0answers
60 views

Rails app that scrapes forum using Nokogiri gem

I've built a website that scrapes a guitar forum's pages and populates Rails model. I'm using rake task along with heroku scheduler to run background scrapes every hour. On the homepage, the forum ads ...
10
votes
4answers
1k views

Send email just once per day

I want to send an email just once per day. There is one button and any user can click that button. The email must not be sent twice. When the first user clicks the button, the email is sent. If ...
3
votes
2answers
193 views
4
votes
1answer
76 views

Pausing a SwingWorker with a Timer

I made a SwingWorker which is fetching tweets using the twitter4j API. The twitter API will allow 180 queries every 15 minutes, and then throw an exception with ...
3
votes
1answer
257 views

Error Handling - Controller's OnException and Application_Error

I'm pretty new to MVC. Below is the code that I have added to an existing MVC 5 application. The code is using log4net to log any run-time error/exception. NOTE: I could override ...
7
votes
2answers
88 views

Exception handling for HTTP request timer

This method is used to check a URL and return the time it takes to check and the HTTP status code: ...
3
votes
1answer
63 views

Throwing an exception within a try/catch block in PHP

Is there a cleaner way to do this? ...
7
votes
3answers
127 views

Creating check parameter class instead of repetitive null checks

What I'm trying to accomplish is to have a error checking class mostly to check if parameters that are pass null but also data structures within class are not null. So my thought is a clean static ...
4
votes
1answer
50 views

If vs try/catch

The following code, written in synchronous Node.js and intended to be used as a shell script, nests a try/catch inside a conditional. Because both the conditional and the try/catch serve a similar ...
6
votes
2answers
91 views

Retry loop for asynchronous HTTP requests

I've got a method that needs to PUT data to a web API. Sometimes the connection fails, so I needed a way to do retries, but if the retries fail, I still need to capture the exception and re-throw it. ...
7
votes
4answers
1k views

Dice-rolling program

I am sort of new to programming. I would like to understand the code areas that are garbage and could be better written keeping the exact (if possible) behavior the code has now. ...
4
votes
2answers
145 views

Game framework using C++

I'm writing my own game framework and would like to get feedback on the API while I'm writing it. At the moment it's very simple, but I would like some guidance about where to take it. This is a ...
4
votes
1answer
52 views

Using quickCheck for “99 Haskell problems” - problem 1

I'm working on learning Haskell, and I've implemented a solution to the first of the 99 Haskell problems. Here is my code: ...
4
votes
2answers
267 views

PHP and MySQLi login script - is it secure / am I doing something wrong?

Below is the code for my login page. I haven't really used MySQL (especially OOP) before, so I'd like to know if I'm doing something inherently wrong. The code is working as expected, but I don't ...
7
votes
3answers
376 views

Handling exceptions for providing log information while debugging

I am catching exceptions to provide better information for the logs to make debugging easier in production. I was wondering if this code follows best practices as I'm not really handling the error ...
14
votes
8answers
1k views

Console application for providing detailed error messages

I'm writing a console application where I need to provide detailed error messages in case anything goes wrong. As a result of this, I find myself splitting up my code into many pieces and making sure ...
8
votes
2answers
166 views

Better option than “errno” for file IO error handling

I have the following method for opening a file: ...
3
votes
1answer
56 views

Selenium Java: errorRecovery

I have the following code to select an image using Selenium, only now I have added an errorRecovery. Is there is a better way to right the code in the ...
8
votes
3answers
209 views

Validation/error handling of user input values

This is a tiny learning program that lead to an interesting question: how can I best/most elegantly handle user entered numbers? This method works, fails cleanly, and reads well. It doesn't apply to ...
4
votes
1answer
87 views

Simple way to prevent duplicate logging of errors

I've been tasked with updating our current error logging system to prevent the logging of similar errors (from a single client program) that were probably caused by the same event. The code here is ...
5
votes
3answers
763 views

Class for catching error and logging

I often write something like this in my code: ...
2
votes
1answer
170 views

Simple Operations Calculator

I'm practicing Swing effects. Everything works but for some reason I get a ton of error messages in the command prompt when the fields are empty, despite my attempt to add some exception handling ...
1
vote
1answer
85 views

Is this acceptable usage of try/catch and database transactions?

I am using try/catch syntax in combination with a database transaction to (hopefully) prevent partial registrations. I am ...
4
votes
1answer
58 views

Improvements to nsiZipReader and nsIScriptableInputStream

I wrote this code to list contents of an XPI file and then read the contents in it. I was thinking areas of improvment: I put the zr.open in the ...
2
votes
2answers
97 views

Error Handling When Using Dictionary

I have set up a Dictionary that calls on a class to fill a DataGridView via SQL statements. The problem is in two (out of 5) ...
5
votes
2answers
74 views

Outputting Fractions

This program is to return a number one at a time from a given input list of numbers, with a frequency proportional to probability/fraction associated with each number. I know it could be made a ...