All Questions
Tagged with exception-handling or error-handling
831 questions
0
votes
0
answers
47
views
Remove error from Inputfield when user input value in field in React
After submission if there are any error, on user inputfield typing wants to remove that error.
My Approach.
...
1
vote
0
answers
140
views
Collection Utilities for VBA
Background
I am building a complex, standalone class. It has a property called .Mapping, which should behave like a Dictionary.
...
1
vote
3
answers
158
views
Is this exception handling missing anything?
This is the code. I'm uncertain about the last block.
...
1
vote
0
answers
55
views
Typescript robust Fetch wrapper with Retry and Error handling
I am building a TS wrapper around the fetch that adds automatic retries for certain errors. The error handling using a custom ApiError class and maps various error ...
8
votes
4
answers
1k
views
Python Exception Monitor
I have built a data pipeline in Python (3.12). It typically processes hundreds of thousands of files and runs for several days. A particular pipeline function calls external web APIs that sometimes ...
5
votes
2
answers
201
views
Design By Contract Library in C++
I asked this question on StackOverflow, and got exactly the answer I needed at the time. I am now here to ask - Is this a good design?
The motivation for writing up this library: my shop writes ...
6
votes
3
answers
276
views
GitHub Label Management with GraphQL, Requests, and Loguru
I've developed a Python script that automates the management of GitHub labels. It utilizes both the GitHub GraphQL API (to fetch label data) and the REST API (to update, delete, and merge labels). The ...
0
votes
1
answer
109
views
Implementing safe custom exception [closed]
I was trying to come up with some design to subclass built-in exceptions.
For simplest case I used something like this:
...
0
votes
3
answers
238
views
Java exceptions that show the message when converted to String
I’m working with custom exceptions in Java for stack operations. However, I’m unsure if the exception handling is being handled properly, especially in terms of how exceptions are thrown and caught. ...
5
votes
1
answer
104
views
Find food related words in German: Seeking Feedback on Concurrency and Code Organization
I'm developing a pipeline that processes unknown ingredient data from the OpenFoodFacts API. The goal is to find valid German words that are not yet in their taxonomy.
The tool performs the following ...
4
votes
1
answer
176
views
Replace node type in Drupal
In Drupal 11 or greater, this code is used to change the node type of a node. How would you improve the code if at all?
...
7
votes
1
answer
314
views
Errors as values and Generic Option, Result types in C++
I wanted to get an in-depth view of both Templates and Concepts in C++, so I made this library. https://github.com/Hernanatn/errores--
I'd like to ask:
is this a proper use of concepts?
is the code ...
12
votes
2
answers
2k
views
Robust error handling mechanism in C++ (safer than std::expected)
I've been looking into and experimenting with various paradigms for error handling in C++.
My goals for a robust error handling mechanism would be:
Enforce handling the error cases (in other words, ...
4
votes
1
answer
132
views
Result class to get either value or error
Recently, I had written a Result class. Basically I wanted a function to return result value on success and some error code on failure.
...
3
votes
3
answers
773
views
Capture multiple errors before raising an exception
I have a scenario where I need to store values from some environment variables (names of which I cannot control). My first run at this was pretty basic, however this is not usable as an exception ...
4
votes
3
answers
724
views
Error handling for singly linked list in C
I have seen many list implementations in C in this site; I know its been asked many times. I need some advice regarding:
Quality of my code, especially my list library.
How to handle errors in main (...
5
votes
2
answers
983
views
Simple load balancer
I would like to know the possible improvements in design and concurrency of the following load balancer:
ability to add/register new instance
keep max of 10 instances for load balancer
forbid ...
4
votes
3
answers
858
views
Implementing strscpy(): Is using errno as a negative return value a bad practice?
strscpy() is similar to the standard strncpy() except that it always writes a valid null-terminated string (unless ...
3
votes
2
answers
100
views
Validating a web crawlers page visits with a decorator
I am writing a crawler that is going to end up in production and I was trying to come up with a way to validate its page visits. It scrapes asp.net pages so each scraping process involves a few ...
2
votes
1
answer
123
views
Generic container wrapper type with a default underlying buffer (2nd rev)
This is a revision of the previous question. I was told to ask an additional question with more context for the modified code to be reviewed.
The changes:
changed from ...
5
votes
1
answer
348
views
Generic container wrapper type with a default underlying buffer
I've come up with a type that allows me to encapsulate any container class (that supports std::pmr::polymorphic_allocator<T>) with a buffer and a memory ...
3
votes
1
answer
210
views
initializing a timezone database and getting all timezone names (before main())
I have written the below small program that tries to initialize a tzdb before the main() runs. So once the main function runs, it checks the two global variables (...
3
votes
1
answer
110
views
Scraping website with Python and Selenium to collect data from dynamic website
Summary:
The code scrapes the website and collects the data to store it in CSV. It also downloads selected information that is available for download in PDF format. The details and the entire code are ...
2
votes
2
answers
237
views
Checking file header for magic number in Python
I wrote this to check files for successful compression with LZ4.
Any advice is welcome.
Particularly regarding raising exceptions and error handling.
...
2
votes
1
answer
78
views
Understanding how to properly create a stored procedure that only does INSERT from sourcetable to targettable with dynamic sql
Background and use-case
I need to create a stored procedure where the input parameters will be: @sourceTable, @targetTable, @compositeKey. I'm using available fields for the composite key, since I ...
4
votes
2
answers
129
views
TCP socket base class and Winsock implementation
I'm coding a chat application from scratch in modern C++. I'm currently building an interface for interacting with sockets. I want it to be cross platform. Am I approaching platform independence ...
2
votes
3
answers
2k
views
Math calculation JavaScript. Am I using Objects correctly? Can I use methods / functions to shorten my code further? Also error logging?
Context- CRM system, front-end form.
Requirement- Within a form users have to give a rating to a section based on user inputs, each rating has different weighting. The rating is stored in an option ...
1
vote
1
answer
215
views
Python exception for handling invalid argument types
Greetings
One small problem that anyone have to tackle with in Python is handling invalid argument types ( without an automatic static type checking tool like
Mypy )
One of the best methods for ...
4
votes
2
answers
218
views
Beginner's attempt at TicTacToe
This is my attempt at making a basic TicTacToe game to play against another human player or a computer controlled opponent. The project was a lot harder for me than I initially thought it would be!
I ...
2
votes
3
answers
226
views
Wrap a noexcept C++ library method with a method throwing exceptions with usable explanatory strings to stay DRY
In our apps we're using a shared inhouse library which provides filesystem functions. All the functions are noexcept.
In several apps i found that similar or identical error return translations are ...
5
votes
2
answers
297
views
Kotlin: scoped functions with try/catch support
I'm working with Kotlin for some time. Compared to Java it's more concise. Still it has some legacy inherited from Java. For example the try-catch-construct. Though it has been upgraded from a ...
3
votes
2
answers
512
views
Hardware API, primarily for Error handling
I have a piece of equipment that I am interacting with. The manufacturer provided an SDK and some simple examples of how to interact with the device. However, I need to write an API for interacting ...
0
votes
1
answer
230
views
Handling exceptions of FileInputStream and XSSFWorkbook
Can you tear my code apart with code review comments?
Below is a simple method which reads an XLSX file and does some stuff with it.
I use FileInputStream and ...
1
vote
1
answer
149
views
Two versions of user-specified exception filters that log a different message on match
I'd like to show you two versions of my two functions that support my logging tools. Their purpose is to log a different message (here abort) when an error occured ...
1
vote
1
answer
95
views
C interface exception handling with C++ implementation
Whilst developing a bigger project, I was in need of having basic error handling inside the context of a C interface.
I came up with the following solution.
...
3
votes
1
answer
260
views
Catching the timed out Exception raised by the __init__ method of the class ftplib.FTP
Introduction
I have written a Python class which uses the module ftplib. In this class I have created a private method called <...
3
votes
1
answer
116
views
Error Reporting in WPF app
I want to add an error reporting feature to my WPF app. I have the view for it created; I just need to know when to call it. I am used to web development and this is my first WPF app.
...
2
votes
1
answer
279
views
A simple parser for bencoding format
I have been learning rust sporadically for a while now and decided to write some toy projects. While browsing https://github.com/codecrafters-io/build-your-own-x I came across some bittorrent client ...
2
votes
1
answer
135
views
Outcome error handler, inspired by boost's outcome namespace
I'm creating a little library for my pet project that is inspired by Boost's outcome namespace. The main reason why I didn't want to use the Boost version is that I don't like the overhead of ...
2
votes
1
answer
178
views
Beginner Java Tic-Tac-Toe
I had a Tic Tac Toe assignment for class and the program seems to work fine but I feel like the exception/input handling could be done in a much better way. Is this a good way to approach the ...
-3
votes
1
answer
109
views
Catching any exception and actually do something with it [closed]
Say I have a framework, which should catch any exceptions raised from user code, and actually do something with it, such as converting it to a return value
...
6
votes
1
answer
514
views
Write a simple, clean error message without a backtrace and exit on failure
I want to write on failure to either STDOUT or STDERR a clean, simple error message for the user, without the (verbose) ...
3
votes
2
answers
357
views
atomic spinlock mutex class
This here is the follow-up to this question. I was recommended to implement a Lockable type (similar to std::mutex) that can work with ...
1
vote
1
answer
420
views
Protecting functions from empty DataFrames
Pandas likes to throw cryptic errors when you feed its functions with empty DataFrames saying nothing that would help you to identify the root cause. In order to ...
1
vote
1
answer
252
views
Function to return a file name from lists/dictionary constants
I'm reworking a set of two functions that return a text file name, constructed from a string argument and string variables from a module called inventory. It seems ...
3
votes
1
answer
91
views
Cancelling function execution with a ContinuationError
Although throwing excptions for control flow is a controversial topic there are some quite popular examples of using this anti-pattern like C#'s async routines throwing the ...
5
votes
4
answers
4k
views
Dividing two numbers then handle the divide by zero exception with try/catch
I am new to coding, I hope you can help me to improve my code :)
First of all: The code works correctly.
...
7
votes
2
answers
860
views
Basic scoped timer struct design
I have written the following simple scoped timer struct in order to help me measure the execution time of arbitrary scopes.
Here is the code (live):
...
3
votes
2
answers
157
views
Spring boot shop application with error handling
I'm writing a simple online shop using spring boot, for learning purposes. Right now I have purchasing-service and a product-service. The purchasing-service makes requests to the product-service via ...
2
votes
4
answers
642
views
CSV to list, map to database
I have a code block that imports CSV to list and map to a database. And there are few validations and I've to return error messages based on those validations. Right now all those logic is handled by ...