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)

-2
votes
0answers
28 views

C# Exception Handeling To Check Empty Text Boxes [closed]

I am making my first Area and Perimeter Calculator. I would like to make it so when the user forgets to enter text in the text box(s) or doesn't give anything but hits the Calculate Button anyway that ...
2
votes
2answers
64 views
1
vote
0answers
33 views

PHP class's errors in different languages

I have a data validation class, which I would like to return errors in many languages. I'm not writing the whole class, just the needed parts as my question only refers to that. ...
1
vote
1answer
56 views

Fetching and parsing HTML from a URL [closed]

I get a page with urllib2, then parse it with lxml. There are generally two things that can go wrong: a ...
1
vote
1answer
36 views

Recording a customer's shopping cart as an order 2.0

Some days ago, I put up a question here for review about the best way to handle JDBC transactions in the context of an e-commerce Java web application. After a kind suggestion from user @gardenhead, ...
2
votes
2answers
153 views

Many nested session verification conditions

Can someone give me advice on cleaning this code? It's more messy then I expected. I got like 10-15 more ifs to be added. I've thought of adding the error messsages in methods and then just check if ...
2
votes
0answers
83 views

Improved NullGuard v4 that supports property chains, methods and ignores value types

While working on my simple NullGuard recently I quickly came to the conclusion that this is not enough so I build a more advanced null checking. Once again I ...
3
votes
1answer
37 views

Loading a database table using a promise chain

I am creating a util module that I'm using to communicate with a MS-SQL database. I want each public method to return a promise. I started with a private function that executes a DB query and returns ...
2
votes
2answers
98 views

Recording a customer's shopping cart as an order

I have come up with the following method to post a transaction to a database, in the context of an e-commerce Java web application. The transaction consists in submitting a new order alongside its ...
5
votes
0answers
48 views

Error Handling for XML parser

I have the following Ruby code, which parses an XML document sax style (it's a very simplified version): ...
4
votes
1answer
49 views

Function outcome: consistent approach and easy logging

My goal is to make a consistent and easy way to determine how a function fails/succeeds. I'm looking for code review of my Status class for any bad practices, code ...
8
votes
2answers
48 views

Querying Facebook for details of a user's OAuth token

This class exposes the public method getAuthToken which takes a user's Facebook OAuth token as an input parameter and queries Facebook for information about it - ...
0
votes
0answers
44 views

Exception-logging handler for the DAO layer

I'm a bit clueless on how to handle exceptions. What I've think so far is to use a custom error page for the users so they can't see the full exception for security reasons and log the exception in a ...
11
votes
4answers
160 views

Get Workbook Method(s)

I'm re-writing my Module of standard methods. These 3 are used to retrieve Workbooks as Workbook Objects. The standard I'm aiming for here is "Third-party Library/Add-in". So: Do these functions ...
5
votes
1answer
34 views
5
votes
2answers
37 views

Single class which holds response and error message

I am working on a library which will make HTTP call to my rest service basis on inputs passed to this library. And whatever response comes back from service whether it is successful response or ...
3
votes
2answers
48 views

ErrorManager management

Recently I created a class that would manager errors, log them, and write details about them to files when the function logError was called. It would be done by ...
1
vote
3answers
104 views

Retrying a web request in Python

Is it fine to retry a web service call like this in Python? Would there be any scenarios the exception might not work the way we expect it? I expect it to continue only if it's fine, otherwise just ...
3
votes
0answers
36 views

Stylishly saving source

Simple tool to save a web page's source. Styled to resemble Sublime Text, given frequent personal use. I took the opportunity to learn and apply an MVC approach, the FXML is generated via Scene ...
5
votes
2answers
148 views

Design watchdog, reconnecting to server

I have console application that sends and process XML data. I have created a fault mechanism that the connection drops. I go in a "fault" mode. And try to reconnect to my server. I'm sending ...
3
votes
2answers
425 views

Read sales transactions from Excel

This is a program to read and store the data from a Excel file (.xlsx) which is uploaded by users. Any better approach to reduce the usage of if-else to return the error message? How to design or ...
0
votes
1answer
72 views

Two similar functions for writing data to binary file using BinaryWriter

I have two functions for writing data to binary file using BinaryWriter. The first function has single data object as argument and looks as below: ...
5
votes
1answer
37 views

Initializing an EGL display

I'm somewhat new to writing real-world projects in C, so I'm not familiar with best practices and standards. I'm writing code dealing with EGL and OpenGL, and some setup calls might fail for reasons ...
3
votes
2answers
46 views

AppVersion Struct & VersionParse Exception

I am working on an app that will interact with assembly (app) versions. I created a struct for that, along with an exception for parsing error. Here's the code: ...
2
votes
1answer
37 views

Handling success and failure when retrieving product information

I've got an Angular controller where I have two functions that are repeated inside two functions: ...
2
votes
2answers
57 views

Implementing bounds-checking with exceptions based on an existing bitset container

BitPat here is a wrapper around a bitset. ...
3
votes
2answers
103 views

Throw an exception which contains a nested set of previous exceptions

I have a set of domain objects which try to find a solution to a problem. The top level object has an algorithm which splits up the problem and delegates it to lower level objects, which in turn do ...
1
vote
1answer
53 views

Array search algorithms: performance comparison

I'm making a program that compares multi-key sequential search and Interpolation search in a sorted array by the number of array accesses for my assignment. ...
1
vote
0answers
24 views

Uploading LDAP search results to an FTP server

I know this is quite a generic question, I was hoping it could stay open so I can try to improve my styles. Basically, I have an application that connects to LDAP, performs searches, and produces a ...
0
votes
2answers
45 views

Concatenating multiple strings from a JSON response

I would like to concatenate a series of strings populated from an XHR response. So, I've chosen to do it like this: ...
3
votes
1answer
100 views

Retry Runnable java

I want to make class to retry doing what I want if specific exception happen for n times before throwing exception, so I write below class and used Builder to build it could you please review it and ...
3
votes
2answers
61 views

Delay to avoid cocurrent modification

I was attempting to remove items from an ArrayList while iterating through it, only to find out that Java doesn't like that. So I quickly wrote up a ...
4
votes
2answers
37 views

Raising an error if a variable is not created during class initalization

I would like to properly raise an error if self._header was not created when I initialize a NewFile object. This is working ...
2
votes
2answers
52 views

Controller method to validate and save

I have built RESTful web services. The services endpoints have a similar logic: If the input validation succeeds, do a database operation and return the result. If the db operation fails, return the ...
23
votes
6answers
3k views

Unbreakable average program

I'm creating a program that averages four numbers - three from a file and one from user input. Simple enough. But the catch is, the professor is going to be deliberately trying to break the program. ...
4
votes
1answer
294 views

Layered architecture implementation in a Java web application

I am trying to learn how to design and implement a layered Java web application with a presentation layer, service layer and the DAO layer. I have used the Struts 1.3 framework with Java JDK 1.6 for ...
3
votes
1answer
117 views

Custom error/fatal error and exception handler in PHP

Introduction I wrote three functions that aims to log errors and exceptions as well as show a user a generic error page. Would appreciate some feedback on it with regards to the PSR standards and if ...
4
votes
2answers
277 views

forever.sh - should keep a process alive forever

This script's only responsibility is to keep a process alive. Forever. It's sole dependencies shall be bash and coreutils. I'm ...
3
votes
0answers
129 views

“Extending” the Swift 2 ErrorType protocol

I am building a simple REST client in Swift 2. The methods the client offers can return errors. Every method returns the same errors (network problem, unauthorized, etc...). But each method can also ...
10
votes
2answers
87 views

Creating a pseudo Pivot Table / Database using a 4-D array

Why am I not just using a Pivot Table / Database? a) I've never ever used either before. And I don't have time to learn how before this project needs to actually be finished. b) The final output ...
6
votes
2answers
519 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: ...
6
votes
1answer
81 views

Avoiding code repetition while handling exceptions

For my application, I need to use two slightly different algorithms for persisting an entity: ...
3
votes
2answers
74 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
63 views

Property file loader

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

Printing gitignores

I have written a simple program in Java 7 to write the .gitignore of different file types: ...
2
votes
2answers
79 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
1k 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
153 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
107 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
96 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 ...