All Questions
Tagged with exception-handling or error-handling
50 questions with no upvoted or accepted answers
7
votes
0
answers
249
views
Error handling function (Win32/C)
I have written the following function to be a general "error logging" solution for my Windows API projects. Basically, given a Windows system error code (a la ...
5
votes
0
answers
1k
views
Exception handling: using @JsonProperty value to make error message
If the validation in RestController fails, I need to handle MethodArgumentNotValidException and provide an errorMessage, that ...
5
votes
0
answers
103
views
Testing application stability by throwing random diagnostic exceptions
I'd like to be able to better test application stability. Usually when you're doing this, you run the application and keep your fingers crossed that it won't crash when an error occurs (be it a ...
5
votes
0
answers
1k
views
Downloading images from Reddit using Python 3
I have been working on this small project in order to fetch top-notch images from Reddit. Overall I am pretty confident about the code below but I am not entirely sure about whether my error handling ...
5
votes
0
answers
399
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 ...
5
votes
0
answers
202
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):
...
5
votes
1
answer
117
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 ...
4
votes
1
answer
325
views
Monitoring and re-establishing a PostgreSQL connection
Within a complicated Ruby project, I need to monitor the connection to a PostgreSQL database, as answered here. I use a thread for this purpose. Every few milliseconds, I invoke "consume_input" which ...
4
votes
0
answers
78
views
Error handling best practices using a custom error handling module
I am trying to learn how to effectively use error handling in my code. To do this, I have created a class inside main.py which reads the value of a specified curve ...
4
votes
0
answers
80
views
Python: Exception handling in a logic gate
I'm learning about Python and am going through the OO-stage where I'm building a set of logic-gate classes.
To make the logic more resilient, I only want the user to be able to enter a value of 0 or ...
4
votes
0
answers
629
views
Exception logger for servlets and JSPs
I hate using unnecessary catch blocks and I like to see my code look beautiful. In most of the cases in my project, which is a web application, I can't declare many ...
3
votes
0
answers
1k
views
Android APP FTP downloading file implementation in Java
This is a follow-up question for Android APP connect to FTP server in Java and Android APP FTP uploading file implementation in Java. I am attempting to perform the download operation to specified FTP ...
3
votes
0
answers
102
views
HTTP download function in Rust (async/await)
Why am I fighting the compiler? - Wrote this, which works, but I feel like I'm breaking every rule in the book:
...
3
votes
0
answers
270
views
Async in Railway Oriented Programming in F#
In F# the Railway Oriented Programming pattern can be implemented synchronously using the Result<'t,'terr> type as result value for functions, so they can be ...
3
votes
0
answers
1k
views
Copying content from Excel into PowerPoint as a picture, with error handling
The code below works, but I want to ask if my solution is adequate or if there's something I should structure differently. If it's alright, I'll apply the same code in other subs.
My code copies ...
3
votes
0
answers
50
views
Connect to a database with Diesel
New to Rust and would like some clarification on idiomatic and readable use of Result and Error types. Here I'm simply connecting to a database using Diesel. In my opinion, the use of match and Boxing ...
3
votes
0
answers
25
views
A XMLHttp Request in the browser
Building on a previous answer and an attempt to write a comprehensive XMLHttpRequest example that covers all kinds of possible errors and return them to caller ...
3
votes
0
answers
267
views
A tree command written in Rust - Error Handling
I am trying to learn Rust as my third main language (Coming from Java/Kotlin and Javascript/Node). For that purpose I reimplemented the Linux tree command.
Not ...
3
votes
0
answers
46
views
Creating chart from data fetched from backend
I have a javascript function written which I think is horrible for multiple reasons (which I have tried to mention in the comments in code below).
I want to give it a rewrite following some best ...
3
votes
0
answers
186
views
Follow-up: Script to create symlinks for dotfiles in a Git repository
This is a follow up to my previous question on Code Review. I did try to implement most of feedback provided by thiagoalessio.
This is what my updated code looks like:
...
3
votes
0
answers
242
views
Easy error handling
I've started using the following Error configuration for some simple libraries I've been working on:
...
3
votes
0
answers
260
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
0
answers
369
views
Stylishly saving source
Simple tool to save a web page's source. A result of trying to learn and apply an MVC approach. The FXML is generated via Scene Builder, but included for completion.
I welcome any general feedback on ...
3
votes
0
answers
419
views
"Extending" the Swift 2 ErrorType protocol
I am building a simple REST client in Swift 2. The methods the client offers can return errors. Every method returns the same errors (network problem, unauthorized, etc...). But each method can also ...
3
votes
0
answers
155
views
Sourcemap translator service
This is my first attempt to a serious Node.js application, I've tried to follow the async style of Node at my best, but I have several doubts and I am sure that this code can be massively improved.
...
3
votes
0
answers
570
views
Rails app that scrapes forum using Nokogiri gem
I've built a website that scrapes a guitar forum's pages and populates Rails model. I'm using rake task along with heroku scheduler to run background scrapes every hour.
On the homepage, the forum ads ...
3
votes
0
answers
97
views
Quick 'n' dirty job deferment
I'm just after some sanity checking of this code:
...
3
votes
1
answer
204
views
TimeoutManager: check whether a task has been finished within a given time
I want to make a helper class, which raises an event whenever something is not finished in a certain time.
Example: my program sends out multiple network messages concurrently. After a random delay, ...
2
votes
0
answers
295
views
JavaScript proxy for better stack traces from external libraries
I've been using the excellent pg-promise library for a few years now, but my primary irk with it is that the stack traces are sometimes unhelpful. For example, the following test will fail (currently ...
2
votes
0
answers
73
views
Building a GTD Productivity App Designed through Test Driven Development (TDD)
First, thanks so much for looking at my code. Over the past decade, I have tried every task management apps imaginable. I finally realized that the only way I would ever find my perfect productivity ...
2
votes
0
answers
393
views
Custom MediaController with full screen video image option
I have overridden setAnchorView() of MediaController class to display full screen option icon using below code.The code seems to be working fine in devices I tested but I have few doubts for which I ...
2
votes
0
answers
28
views
Is there a better way to handle errors in these functions?
I'm creating a GOLang Linux distribution installer. The architecture is straight forward. I have N parameters and uses them in N installation steps. Summarizing:
Every step implements a interface ...
2
votes
0
answers
799
views
Implementation of SCPI for control of test instruments
I work with electronics test equipment. I like to be able to automate tests using their remote control interfaces. I have built a pattern, a few base classes, that I can apply to all devices that ...
2
votes
0
answers
29
views
Error handling in express without middlewares and using class structure
This is a simple implementation of Django's sample project "Poll" using and express.
The controller code:
...
2
votes
0
answers
27
views
Thread safe Shareable and Splittable Buffer with Safe Memory (Project)
Backstory
This is a buffer I wrote for use in multiple personal projects. It is designed
to handle pretty much any data in pretty much any way. In particular I intend to
use it in such instances as ...
2
votes
0
answers
669
views
DirectX11 Error Handling
I'm new to C++, been a C programmer most of my life. I wanted to get into graphics and Direct3D is C++ so I figured it was about time. I've been learning about strings, vectors, references, smart ...
2
votes
0
answers
178
views
Historical exchange rate between currencies using Ecbxrate
I tried writing a simple python script using the python module ecbxrate that outputs to a CSV file a table with the daily exchange rate between EUR and USD since ...
2
votes
0
answers
1k
views
RESTful API combining three other APIs
I have created a RESTful API that uses three other APIs with Visual Studio 2017 in .NET Core. It is the first time I have ever programmed in .NET so I am sure the code could use a lot of improvements. ...
2
votes
0
answers
2k
views
Django REST custom methods for generic views
I'm intern and work on a project where I develop DRF API that need to interact with mobile app written by my colleague with Ionic framework.
We are creating new user. My view method is following:
<...
2
votes
0
answers
2k
views
Waiting for all task to complete while catching exceptions early
I'm working on simulating a number of processing elements (nodes) which do some work in parallel and communicate by exchanging messages. The message exchange is not in the scope of this post, but it ...
2
votes
0
answers
70
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 ...
2
votes
0
answers
59
views
Test web application
I am writing a test web application in Golang.
Create post handler:
...
2
votes
0
answers
561
views
Dynamically created Exception classes
This is a question about best practices. I have a project I am building and I have the following base Exception class:
...
2
votes
0
answers
83
views
Restful API for parsing records
I'm trying to implement my own API. This code excerpt should show the basic working routines. The storage is temporary an in-memory-array and the only HTTP method for now is POST.
I outsourced the ...
2
votes
1
answer
67
views
UnitTest strong exception guarantee
I want to properly test the strong exception guarantee of a method.
The method in question is SetFiles. It does not have side-effects (it only modifies the object ...
1
vote
0
answers
28
views
How to optimize authentication and authorization, API calls in a task management frontend application?
Let me give a brief explanation of the mini-application I've designed using Angular :
A simple login page that requires user email and password as credentials. Once logged in, the user is moved to a ...
1
vote
0
answers
54
views
Simple CRUD server in rust
This is my first rust application. I tried to pick somewhat low level dependencies to get a feel for the language particulars.
I'm especially interested in control flow/error patterns in rust as I ...
1
vote
0
answers
94
views
Dictionary based non-local mean implementation in Matlab
Given a dictionary including multiple X-Y pairs where X, Y are both three dimensional structure. dictionaryBasedNonlocalMean function return a ...
1
vote
0
answers
3k
views
REST API returning NotFound (404) if record is not found in the database
I'm not really sure what the preferred way is to deal with records not found in the database. Is it better to write a Find method which returns ...
-1
votes
0
answers
2k
views
Watchdog for multiprocessing
The code shows here is a demo of my application. The func1 always hang somewhere with reason I haven't figured out by now. Now I just want to write a watchdog for this process. If it didn't generate ...