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
vote
0answers
16 views

Handling errors in a PHP class to submit two forms [on hold]

I am trying to handle errors in a class written in PHP and using curl. This class uses 3 functions (init, ...
0
votes
0answers
13 views

The Same Behavior for Boolean and Exception

The following code uses a boolean preference active: In the active state, it does an operation which could throw an exception. On this exception, it does fall back ...
2
votes
0answers
24 views

Easy error handling

I've started using the following Error configuration for some simple libraries I've been working on: ...
1
vote
2answers
74 views

Validating username, password, and email in PHP

Let's pretend the following: ...
2
votes
1answer
34 views

Simplified error handling when reading from stdin and parsing to a type

I've recently started learning Rust, and I've managed to whip up this function, which reads and parses a thing from stdin. I don't like it though, and I feel it ...
3
votes
1answer
47 views

Class for Value + Error Code

This is a class similar to std::pair and std::tuple inspired by Alexandresku's ...
2
votes
0answers
21 views

Pushing data to an analytics API

This is code that handles pushing data to an analytics API, and IMO it feels too much like Java. logActivity is a method that uses ...
3
votes
1answer
98 views

Using a Boolean method that never returns “false” to check user permissions

I need to check that a user is allowed to save/retrieve contacts to/from the database by calling a web service, and return an HTTP403 with an explanation if it is not the case. So for the sake of ...
1
vote
1answer
53 views

Disposing of an SQL dataset

I am getting a compiler warning when running my code analysis. It is CA2202. It is saying that I have not properly disposed my dataset through all exception paths. Here is the code: ...
3
votes
4answers
98 views

Copying file dependencies

I have written the following code, and it works great, but I'm not satisfied. I really love the book "Clean Code" by Uncle Bob and I try to apply all his principles when coding, but I'm having a tough ...
4
votes
4answers
32 views

Handling errors with minimal repetition when using Find function

I have a function that essentially searches out a value in a table by looking through the column headers and row headers to locate a data point. The function takes the sheet name, the column header ...
2
votes
1answer
60 views

Print Trace Debugger

Notice: The original library has since been replaced by: https://github.com/JohnReedLOL/scala-trace-debug See my Scala print trace debugger. This project is used for lightweight debugging sort of ...
0
votes
0answers
8 views

JUnit @Rule ExpectedException [migrated]

I have been trying to use the JUnit expected Exception to validate my own exceptions for an application, however whenever I try to use this the compiler complains that there is an uncaught exception. ...
1
vote
2answers
84 views

Asynchronous lookup over HTTP and checking the status

For some reason declaring ApiResult before checking if the answer is in a correct status doesn't look good. I wonder if there is any better way to check the status ...
2
votes
2answers
45 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 ...
2
votes
2answers
65 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
39 views

Retrieving access token from SharedPreference

Here is code that retrieves an access token from SharedPreference. ...
3
votes
3answers
70 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
44 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
51 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
301 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
38 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
63 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
58 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
63 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
40 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
46 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
68 views
1
vote
0answers
41 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
64 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
158 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
85 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
58 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
101 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
60 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
52 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
75 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
179 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
47 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
52 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
146 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
41 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
213 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
443 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
90 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
40 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 ...