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
18 views

Design issue with constructors who has exceptions [on hold]

This has been boggling me for some time now and I can't think of any good solutions to it, at least with would satisfy my twisted mind. So lets say we have a class Person: ...
3
votes
1answer
42 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
92 views

Searching for an account by accountId

I have a piece of code that is fetching account objects from a service ...
2
votes
2answers
58 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
23 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
67 views

Getting rid of goto without duplication in Go

Consider the following function: ...
1
vote
1answer
28 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
108 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
57 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
114 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 ...
0
votes
0answers
36 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
372 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
27 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
367 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
24 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
432 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
40 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
34 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
50 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
117 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
115 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
49 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
92 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
54 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
52 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
122 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
59 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
60 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
80 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
64 views

Controller action to process orders and payments

I'm trying to reduce the if statements and simplify this create action. ...
3
votes
2answers
547 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 ...
5
votes
3answers
433 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
2answers
83 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
65 views
1
vote
2answers
105 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
366 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
166 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
109 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
131 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
271 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
437 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
1k 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
40 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
69 views

Type determined return values

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

When should I call set_exception_handler with this exception handler class?

This is a simplified version of ExceptionHandler.php: ...
3
votes
1answer
174 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
148 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
854 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
75 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
261 views