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.
1
vote
2answers
59 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 ...
1
vote
1answer
28 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:
...
0
votes
0answers
12 views
Errors with running a time series lag in for loops in R [on hold]
I am having issues with for loops that calculate and run lags for the coefficient of variation of precipitation. I'm not quite sure how to generalize the question so I've added all the steps I've ...
2
votes
2answers
56 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
96 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
112 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
156 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
67 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
73 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
39 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
58 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 ...
1
vote
1answer
44 views
2
votes
2answers
239 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
72 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
56 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:
...
5
votes
2answers
214 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
91 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 ...
7
votes
4answers
463 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, ...
10
votes
1answer
282 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 ...
12
votes
7answers
3k 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
129 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
102 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
156 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
421 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
125 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
203 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
293 views
Saving and listing Category model
I have this ExpressJS route for saving and listing Category model.
...
4
votes
1answer
221 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
712 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
129 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
380 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 ...
3
votes
2answers
215 views
Storing and iterating over multiple NSError pointers
How would you refactor this kind of code? I've unsuccessfully tried several approaches (NSArray, NSPointerArray, plain C array), but always ran into pointer type checking error.
...
4
votes
2answers
499 views
Splitting a string of random length
I am currently using this code, but I am pretty sure there is a better way of doing it:
...
2
votes
1answer
217 views
Suggestions for improving error handling
I am interested in finding out what is the correct way of implementing error handling for this situation in C#.
The system tries to do an operation. If the operation succeeded (returns a non-error ...
0
votes
1answer
230 views
What is wrong with these PHP arrays, is_array returns false and foreach says invalid [closed]
I have hit a brick wall in my project: PHP doesn't consider the $bon_v1 an array.
What is wrong with all of this/ some of this?
...
2
votes
2answers
153 views
Add events dispatching for ActionScript framework Robotlegs
I have the following function in a Service class
...
3
votes
2answers
1k views
HttpClient error handling
I would be happy to hear feedback on my implementation of HttpClient. I am not so strong with error handling so I want to improve. My thought process behind this was that ...
0
votes
1answer
62 views
uplifitng return value error reporting to Exception based error reporting
In Framework Design guideline book there is a chapter about Exception and they talk about return-value-based error reporting and exception based error reporting and the fact that we in a O.O language ...