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

Throw exception in Spring when loading a file

I have this following piece of code: ...
0
votes
0answers
18 views

Php Ajax script to check server status of sites from db

I am writing a script for a client so hey can check the status of their servers. The script performs ajax requests to get the data as json then poulates the table with the returned json results. is ...
7
votes
1answer
56 views

Class: 2D Variant Array

Note: Yes. It's big. I'm not expecting commensurately long/detailed answers (though if anyone wants to write one, you'll definitely be receiving a substantial bounty). This class is going to be ...
3
votes
1answer
96 views

TryRetry - Try, Catch, then Retry

I have created a class to try, catch and retry N times. My class also supports retrying asynchronously. I'm wondering if there are better ways to implement this. I'm most concerned with the ...
3
votes
0answers
95 views

Is Pokemon exception handling ever acceptable? [migrated]

Normally, I don't anticipate exceptions and if I get them, its something that I can't fix in my code - bad user input or connectivity issues with the database. But errors do occur so at the very ...
1
vote
1answer
34 views

Checking whether a nonnegative number is present in a database [closed]

There is this function that checks if data is present in a database table. I am currently using try-catch instead of multiple ...
-1
votes
0answers
36 views

object.ErrorHandler.js - handles errors on bubble and capture phase

Is this a good way to handle errors? Right now I'm using it to capture image errors, but I want to expand it a bit. Can I catch runtime errors this way? ...
1
vote
1answer
21 views

Logging errors in google analytics

Apart from general JavaScript knowledge, this snippets requires someone who knows how to properly use Google Analytics API. To log errors on my site, I use this code: ...
1
vote
0answers
48 views

Reading files and displaying their content

I'm writing a program to read two files supplied as arguments in the command line, convert them from list to char[][], and display their contents to the user. I'm trying to practice ...
2
votes
2answers
50 views

Program to edit an address book stored as a JSON file

I was told to come here from Stack Overflow. I'm trying my hand at an address book and the goal is for it to have a bit more of error prevention, for instance for the key "phone" to have 10 digits, ...
1
vote
1answer
63 views

WebAPI Handling fire and forget exceptions

This is a fire and forget task from within an existing WebAPI service. The code below simply sends a log event (might be that a client has connected to the service to perform some task) to another ...
1
vote
1answer
28 views

Validation of uploading images and adding records to the database

I am doing a php project with the codeigniter framework. In my controller, I have a function that does the following. Uploads an image to the server Add a row to the database. The data would be ...
1
vote
1answer
111 views

Implementation of API to create a company account in a database

I'm working on an API that has a lot of controller functions like this: ...
3
votes
1answer
17 views

Varnish - HttpClient Exception Handling

I'm consuming some messages from a rabbit queue. Within the consumer/processor I need to invalidate a varnish cache and requeue the message if the purge failed. I'm using a local purge proxy. The ...
1
vote
1answer
23 views

Python exception handling class - Getting as much details printed

I'm trying to write a Exception Handling class in Python so that I can re-use. If you have any ideas on how I can improve this to output more detailed information I would appreciate it: ...
6
votes
2answers
50 views

End of day receipt emailing process

The following functions/routines are an automation of an end of day receipt emailing process that formerly would take up to an hour, but now takes less than a minute. Things to note: I changed the ...
4
votes
0answers
78 views

Unit Testing Against Exceptions

I am writing a Swift library. I'm writing unit tests for that library. I am afraid that some of the code that I am testing will possibly throw exceptions. In Swift, we can handle errors, but we can ...
0
votes
1answer
75 views

Context manager for SMTP connections

My code right now look like this ...
0
votes
0answers
24 views

Renaming image files based on OCR words

I wanted to rename a large batch of image files, based on a best-guess attempt to OCR words from the file. These are all logos, which generally bear a the name of an organization. The code presumes ...
3
votes
1answer
49 views

Uploading multiple files using a class

Below I have implemented a class that will validate and upload files based on the specified rules. ...
5
votes
1answer
32 views

Transferring data from one file stream to another

I am currently reading Clean Code and for fun and profit, I intended to refactor some of the Java Tutorials and since I wanted to improve my Exception handling, the Byte Stream one with its lots of ...
4
votes
2answers
96 views

Optimize the CSV Upload function in Ruby On Rails

The code is working fine however, I would like to fix code after unless and can I store thread ID in the database too? Is there a way to improve performance? ...
3
votes
2answers
366 views

Count rows of a table

I am trying to count the rows of two tables generated by SQL connections in Excel VBA. My plan was to use ListObject.DataBodyRange.Rows.Count however, this errors ...
1
vote
0answers
42 views

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

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

Easy error handling

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

Validating username, password, and email in PHP

Let's pretend the following: ...
2
votes
1answer
38 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
50 views

Class for Value + Error Code

This is a class similar to std::pair and std::tuple inspired by Alexandresku's ...
2
votes
1answer
39 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
102 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
61 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
114 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
3answers
37 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
65 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 ...
1
vote
2answers
91 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
48 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
76 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
40 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
53 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
65 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
327 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
73 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
72 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
407 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
64 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
45 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
53 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
70 views