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

0
votes
0answers
28 views

Mini eCommerce Application and Message/Warning/Error Handling

I decided to build a basic eCommerce application in C++ as a learning experience. In the past, I've gone with a fat controller, skinny model approach, and while it has worked, my results always end up ...
2
votes
1answer
39 views

Error Handling - Controller's OnException and Application_Error

I'm pretty new to MVC. Below is the code that I have added to an existing MVC 5 application. The code is using log4net to log any run-time error/exception. NOTE: I could override ...
7
votes
3answers
112 views

Creating check parameter class instead of repetitive null checks

What I'm trying to accomplish is to have a error checking class mostly to check if parameters that are pass null but also data structures within class are not null. So my thought is a clean static ...
4
votes
1answer
46 views

If vs try/catch

The following code, written in synchronous Node.js and intended to be used as a shell script, nests a try/catch inside a conditional. Because both the conditional and the try/catch serve a similar ...
4
votes
2answers
135 views

Game framework using C++

I'm writing my own game framework and would like to get feedback on the API while I'm writing it. At the moment it's very simple, but I would like some guidance about where to take it. This is a ...
4
votes
1answer
45 views

Using quickCheck for “99 Haskell problems” - problem 1

I'm working on learning Haskell, and I've implemented a solution to the first of the 99 Haskell problems. Here is my code: ...
4
votes
2answers
88 views

PHP and MySQLi login script - is it secure / am I doing something wrong?

Below is the code for my login page. I haven't really used MySQL (especially OOP) before, so I'd like to know if I'm doing something inherently wrong. The code is working as expected, but I don't ...
14
votes
8answers
1k views

Console application for providing detailed error messages

I'm writing a console application where I need to provide detailed error messages in case anything goes wrong. As a result of this, I find myself splitting up my code into many pieces and making sure ...
7
votes
2answers
110 views

Better option than “errno” for file IO error handling

I have the following method for opening a file: ...
4
votes
1answer
70 views

Simple way to prevent duplicate logging of errors

I've been tasked with updating our current error logging system to prevent the logging of similar errors (from a single client program) that were probably caused by the same event. The code here is ...
2
votes
2answers
83 views

Error Handling When Using Dictionary

I have set up a Dictionary that calls on a class to fill a DataGridView via SQL statements. The problem is in two (out of 5) ...
5
votes
2answers
70 views

Outputting Fractions

This program is to return a number one at a time from a given input list of numbers, with a frequency proportional to probability/fraction associated with each number. I know it could be made a ...
2
votes
2answers
97 views

Checking empty object

Is there a better method for covering errors in my case? I am looking for best practice for now and future instances. Foreseen errors that could arise: No attributes at all Some attributes could be ...
7
votes
1answer
143 views

Extending the VBA Extensibility Library

The Microsoft Visual Basic for Applications Extensibility library let's us meta-program VBA, but the way it handles (or rather, doesn't handle) getting to the actual subs and functions is clunky at ...
7
votes
1answer
92 views

File reader/writer (text)

Following-up on this post, I wanted to be able to use my FileWriter with a syntax reminiscent of .net's using blocks, which ...
7
votes
3answers
78 views

FileWriter supporting writing to multiple files

I got bored with opening and closing files whenever I need to write to one, so I wrote a FileWriter class that's used like this: ...
2
votes
0answers
81 views

Parsing a website

Following is the code I wrote to download the information of different items in a page. I have one main website which has links to different items. I parse this main page to get the list. This is ...
6
votes
4answers
149 views

What is a good way to check errors from a series of function calls?

I have to work with C style functions which return ERROR_SUCCESS when successful, otherwise return an error code. I want my code to be nice and neat and easy to ...
2
votes
2answers
409 views

Program simulating dictionary using file handling

I have made a program in C++ simulating a dictionary with very basic functionality. I do not have much experience in file handling with C++. Also, I want it to run on Linux and Windows. It would be ...
4
votes
2answers
65 views

Executing a file through a swing button

I am making a Swing application for light local database management and I have the button Run XAMPP. When that button is pressed this code is executed: ...
2
votes
2answers
93 views

Python and Exception Handling IOError [closed]

I'm trying to work with exception handling by displaying "No Such File" when the file doesn't exist. I need to use a try statement. ...
4
votes
1answer
113 views

Throw exception in favor of an error?

I've been reviewing my previous projects for the last few days. I've found that I never return an error from any of my methods. I always throw exceptions. I googled about exceptions vs errors and I ...
3
votes
1answer
144 views

Seeding a file with fake records - doing concurrent updates

I need to seed a database with user data. When trying to write records to a file using sqlite3 with node, I tried writing the logic in a naive manner, without any error checks - but it was failing ...
3
votes
2answers
217 views

Simple structure that would contain validation errors messages

Before I go too far, does this look right? This is mostly to have a "central" place that hold a "hierarchical/structured" errors message. ...
4
votes
2answers
364 views

HttpURLConnection response code handling

This snippet from a downloader callable handles HTTP status codes. I need critique on both the style (for or do-while loop ...
4
votes
1answer
86 views

Is recursion like this safe with a task queue on GAE?

I've written a function to call with the deferred library to generate a large task queue, and at first without the recursion it timed out (deadlineexceeded) so now I'm trying with a recursion but is ...
2
votes
2answers
45 views

Is this an appropriate approach and layout for conditionally continuing execution in bash?

I've seen others use && for conditionally continuing execution in bash, and found it effective but rather ugly. (I'm not sure if there's a better name for this technique.) ...
4
votes
1answer
64 views

How to properly detect multiple devices failure?

My software has multiple devices connected before starting. I must be sure these devices are working and are well connected. every device has different error ID code so we can see every component that ...
4
votes
1answer
89 views

Can I rewrite this with pattern matching?

I've got the following Elixir code: ...
1
vote
1answer
47 views

Use of multiple value errors in Python

Review this code. ...
2
votes
2answers
877 views

Consistent way to handle transient timeouts with WCF calls (timeouts, unreliable network, server load, etc)

I'm currently using the following code to manage calls to WCF services that are unreliable, and or suffer performance load issues due to contention. Right now this code is limited to solving issue ...
4
votes
2answers
85 views

Making a minishell in C. How to improve error control with feoh and ferror?

I've written this minishell but I'm not sure I'm making a correct control of the errors. Could you give me some advice? ...
6
votes
1answer
83 views

Functions that converts day of year to month and day and reverse with error checking

There is no error checking in day_of_year or month_day. remedy this defect. Here is the solution: ...
6
votes
2answers
297 views

Optimising and error handling Linq query

I have 2 tables as below: Downtime DowntimeCode I am then doing this to get the Description field from the DowntimeCode table for the DowntimeCode with the sum highest value in the Downtime ...
6
votes
1answer
111 views

Structuring functions receiving and returning promises?

I keep running into the same pattern with code using promises in javascript. When writing a function which takes a promise and returns a promise, obviously I want to reject the promise I'm returning ...
8
votes
5answers
2k views

Reading from a serial port

I'm receiving data from a serial port in C, using Serial Programming Guide for POSIX Operating Systems as a guide. The data I receive should be always 10 bytes in length but I want to be sure that, ...
12
votes
1answer
443 views

Brainfuck-to-C compiler written in C++

This compiler, implemented in C++, takes brainfuck code and produces a valid (but still obfuscated) C program, which in turn can be compiled to a native binary. Expected usage is as follows: Build ...
7
votes
2answers
121 views

Idiomatic Scala try option code block

Trying to learn scala. Wanted to know if this is the standard way of doing things in Scala - or is there a better way to write this code ? Basically, this function returns a list of flights for an ...
12
votes
7answers
7k views

Euclid's Algorithm (Greatest Common Divisor)

According to Donald Knuth in "The Art Of Computer Programming", the following is how to find the greatest common divisor of two positive numbers, m and n, using Euclid's Algorithm. Divide m by ...
7
votes
3answers
132 views

Exceptions handling, what would you do?

I know that there are several ways to handle exceptions and probably a good way is to keep the handling consistently and use the pattern which feels comfortable for himself, but I would like to get ...
1
vote
2answers
133 views

A Tour of Go, problem #56 - error handling

New to Go, trying to solve Tour of Go, Exercise 56, which is about error handling. Can the following error handling method can be further improved? ...
3
votes
1answer
169 views

Shoot me for my nesting… then could you please help me with a better thought process

I have the following method that's in a common library. It's ugly - fair warning. I want to know how to write it better, but mostly, I want to know how to think about this better so I don't end up ...
5
votes
4answers
743 views

Cleaner way of returning true/false with error message

What's a concise way of returning true/false with an error message? Here's a concrete example. I'm building a parser that takes in a file. ParseReplayData does some validation before proceeding with ...
2
votes
2answers
130 views

Error handling, general architecture and commenting style review

I'm writing a C++ wrapper library for sockets which will hopefully be cross-platform. It's basically two headers: mizaru.hpp, which contains the wrapper classes ...
1
vote
1answer
478 views

Handling nil: Trying to avoid #try

Yesterday, I introduced a bug into our codebase by calling #titleize on a string that could possibly come in as nil: ...
2
votes
2answers
308 views

Saving and listing Category model

I have this ExpressJS route for saving and listing Category model. ...
4
votes
1answer
372 views

Catching all exceptions and errors in PHP

I've tried to catch all exceptions and errors in PHP in a way so that I can deal with them consistently. This is the code with the exception of the very last bit where I instead pass ...
2
votes
1answer
1k views

Setting variable if it doesn't exist in Dictionary [closed]

I was wondering if this was good design from client side calls. In the event that the key doesn't exist, go ahead and add it. ...
2
votes
2answers
131 views

error handling logic in php

I'm wondering if you see anything terribly wrong with this code, or if you see any areas for improvement. My objective is to make sure its simple enough for someone else taking over my job to be able ...
1
vote
1answer
521 views

Best way to handle repetitive error code or return value

I have a wrapper which interacts with a third party component. In Each function i am performing the operation if it the component is initialized. I have other function to check the errorCode and ...