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
2answers
41 views

Instantiating different kinds of error records for a database operation

I've written code to be called from Powershell like so: Rename-DatabaseUser -Name 'someuser' -NewName 'somenewuser' I'm wondering if there's another way I can ...
-1
votes
0answers
30 views

Validating a database connection

I need to validate database connections in a separate function. Why is SonarQube plugin for Jenkins complaining about the open statement if I close it in the finally block? ...
2
votes
2answers
51 views

Validating user credentials and logging into a Symfony site

I have the following code in a Symfony site that validates a user's credentials and logs them in via the Session class: ...
1
vote
1answer
30 views

Retrieving access token from SharedPreference

Here is code that retrieves an access token from SharedPreference. ...
3
votes
3answers
68 views

Application that processes XML based on configuration

I used CodeClimate to evaluate my code and marked that the following piece of code appeared twice in my source: ...
2
votes
2answers
43 views

RSS to JSON for insertion into MongoDB

In my code, there is a chain of functions call where the deepest function may throw an exception. I catch and handle it according to the business logic. The problem is that all other functions in the ...
2
votes
0answers
41 views

AggregateException handling

How do you handle AggregateException? It is really useful in many TPL or business scenarios, but handling is a real pain. I defined the following three extensions ...
4
votes
3answers
290 views

'Retry' mechanism with callback

We've had a situation whereby we have to cater for certain exceptions and retry a particular method whenever these exceptions occur. This is required in various parts of the system. In addition, we ...
2
votes
0answers
37 views

Javascript Either

I wrote this up out of necessity, then realized that I actually needed to write it in PHP. Just so I didn't waste the last hour, I'd like a review of it. My concerns: This is my first time using the ...
1
vote
1answer
57 views

Code to analyse text get stuck if too much data

I've made the following VBA script to analyse text recurrence in a huge batch of descriptions. For a small part of the batch the code run smoothly, but when I include everything it tends to loose ...
3
votes
0answers
53 views

Keeping error details out of responses (Restify)

I'd like to make sure error details are never sent out in responses from my restify-powered API. The best way to achieve that seemed to be via wrapping server.formatters in another function which ...
3
votes
2answers
403 views

Python exception handler to recommend package

Consider this python 3 snippet, where when an import exception is raised, a string 'e' is created that says: "No module named ' packageName'". The goal is to simply say on exit, that the import error ...
3
votes
2answers
61 views

BMP file writer

In my current project I'm writing a C function to write a BMP-File. Internally, the function is split up into three parts: write header, write info header, write data. In some of these functions I do ...
3
votes
1answer
37 views

Linq-to-Sage: CRUD Operations

Following-up on my Linq-to-Sage implementation, I ended up implementing all CRUD operations, following the Sage 300 view protocols. So, the entities derive from classes that look like this: ...
0
votes
0answers
45 views

Ingest data from an RDBMS to Hadoop Hive database using Sqoop

Context: The below code will run a series of steps in an ETL workflow. I would like the code to be reviewed to avoid memory bottlenecks and null pointer exceptions etc. UseCase: Ingest the data from ...
2
votes
2answers
66 views
1
vote
0answers
36 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
62 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
37 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
156 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
84 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
46 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
99 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
54 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): ...
3
votes
1answer
51 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 ...
7
votes
2answers
54 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
56 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
171 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
37 views
5
votes
2answers
38 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
50 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
119 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
40 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
171 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
431 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
80 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
39 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
49 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
39 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
105 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
55 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
26 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
46 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
118 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
63 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
53 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. ...
5
votes
1answer
453 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 ...