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
32 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 ...
4
votes
0answers
14 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 ...
1
vote
0answers
28 views

Use of get queryset and using pass to ignore an exception and proceed in my django view

I wrote a view to update my draft object. Before updating my draft I need to see if any draft exists for package(draft.package) in db or not. If any draft is ...
3
votes
1answer
52 views

Ruby selenium script waiting for an element to disappear

I'm a Java developer, I'm new to Ruby and I'm worried that I'm forcing or not-so-well using the goodness of the Ruby syntax. What do you think about the Exception catching and how to print it in ...
-2
votes
2answers
92 views

return inside a loop - is it a good style? [closed]

Is it a bad style to return inside a loop? I have the following method ...
2
votes
1answer
46 views

Error checking in function that returns reference to static variable

This is a function I just wrote with the goal to only load the desired information once, and if an error occurs, save it for later so that it can always be reported to a calling function. It does ...
0
votes
2answers
45 views

Extract data from database and write them to file

I wanted to write a program that performed a query to a database, then formatted the data before writing it to a file. I thus created 4 classes, which are: a main class a class dealing with the ...
1
vote
1answer
50 views

Making an HTTPS request more readable

I think the snippet is too nested having too many blocks. It needs to be refactored to make the logic more readable. The try exception is the first level block ...
1
vote
1answer
34 views

Handling errors when using PDO to connect to a database instead of MySQLi

What would be the preferred method for handling errors when using the PDO to connect to a MySQL database? I was using mysqli_error($this->pdo), but I heard this ...
3
votes
0answers
97 views

Exception logger for servlets and JSPs

I hate using unnecessary catch blocks and I like to see my code look beautiful. In most of the cases in my project, which is a web application, I can't declare many ...
0
votes
0answers
32 views

Is this a safe way to do my own embedded dialog and exception handler?

I'm developing a multi-platform app via Delphi XE7 with the Firemonkey framework. I wanted to eliminate the sloppy Windows exception modal window, so I created my own in-line modal prompt dialog. It's ...
4
votes
1answer
49 views

Do you view this ThrowingFunction interface as “interface abuse”?

I am currently implementing a fun project involving lambdas and this project makes heavy use of the ability of Java 8 to have default methods in interfaces. But when does such "heavy use" turn into ...
7
votes
3answers
62 views

Checking for intersection points

The aim of the program is to find those points which comes under the intersection of at least 2 circles.(space is a 1000x1000 matrix) ...
7
votes
1answer
59 views

Controller action to process orders and payments

I'm trying to reduce the if statements and simplify this create action. ...
3
votes
2answers
136 views

Multi threaded TCP server

I wrote this just for fun, to hone my exception handling skills. I want to know what I can do better in terms of exception handling (and otherwise) in the below code Server ...
1
vote
0answers
32 views

Multicast Mining Rig Scanner [closed]

The class MulticastMinerScanner is a Runnable that scans for miners (computers running a mining client called CGMiner, which is configured to listen/respond for a multicast message containing the ...
5
votes
3answers
423 views

Try/catch in a Tic-Tac-Toe game

I'm looking at my code and it doesn't look very efficient. I'm simply trying to catch exceptions or prevent them from being thrown in the first place. Can you please take a look and tell me if there ...
4
votes
1answer
59 views

Querying MongoDB for information on a collection of books

I have this huge chunk of code. Is there any better to write this code, or am I too paranoid that I check every MongoDB query for error? The logic is here: Bookcollection = collection of books Book ...
0
votes
1answer
61 views
1
vote
2answers
101 views

Stop connecting to a server after n unsuccessful attempts

I am trying to connect to a server. If the connection goes through, then print an apt message. If the connection does not go through, try for a total of n times. And quit after the nth attempt ...
5
votes
4answers
332 views

Java Stream Exception Handling

I find this piece of Java code really ugly and cumbersome. How can I refactor it to be more clean and easier to read? ...
2
votes
2answers
159 views

Returning latest database ID

I want my method to use a finally block so I can be ure that my EF entity is disposed after usage, even if an exception is thrown, but I would also like to not ...
2
votes
1answer
81 views

Is this the right way to handle Exceptions in PHP?

I'm using the function countLikes() to fetch URLs' Likes count from the Facebook API. ...
7
votes
3answers
116 views

RateBeer.com scraper

This was largely an exercise in making my code more Pythonic, especially in catching errors and doing things the right way. I opted to make the PageNotFound ...
4
votes
1answer
125 views

AsyncTask which allows to handle exceptions on UI

The AsyncTask available in android, gives you the result from doInBackground on the UI thread so that you can update UI ...
0
votes
2answers
204 views

Elegant way to handle errors with JSP and Servlets (Model 2)

I have a form that submits to a registration Servlet, which inserts a new user to the database when they sign up to the web application. Depending on the erroneous user input, the Servlet will ...
3
votes
2answers
588 views

Class design for a student class

Problem Statement: Design a STUDENT class to store roll, name, course, admission date and marks in 5 subjects taken from user. Create an array of STUDENT objects. Provide methods ...
2
votes
1answer
35 views

Improving efficiency and flow by changing subroutine orders

A batch file executes WinSCP.exe's console mode to download files and log the actions. Upon exit, WinSCP returns: ERRORLEVEL 0 if the files are successfully ...
1
vote
3answers
68 views

Type determined return values

I have the following js code: ...
1
vote
1answer
88 views

When should I call set_exception_handler with this exception handler class?

This is a simplified version of ExceptionHandler.php: ...
3
votes
1answer
120 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 ...
7
votes
2answers
126 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
331 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
64 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
157 views
4
votes
1answer
142 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 ...
3
votes
1answer
573 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
547 views

Exception handling best practices

I'm actually working on a piece of code which use the following code: ...
3
votes
2answers
49 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
134 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: ...
9
votes
3answers
1k views

Coding style of critical server's code

I was writing a server that should serve more or less a thousand clients. After writing the net part of the server code I had to stop writing because I saw that the code was chaotic and not very ...
0
votes
1answer
27 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
829 views

Writing null-safe code to set form values

I will ask my question using the following example: HTML ...
1
vote
1answer
54 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
345 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
701 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
133 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
50 views
4
votes
3answers
206 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 ...