Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [exception]

An exception is a rarely occurring (exceptional!) condition that requires deviation from the program's normal flow.

0 votes
1 answer
134 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 ...
KhodeNima's user avatar
  • 399
2 votes
3 answers
173 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 ...
ridilculous's user avatar
3 votes
1 answer
198 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 <...
User051209's user avatar
2 votes
2 answers
236 views

User-defined Exceptions for Stack implementation

I am learning about user-defined exceptions in python and I have tried to incorporate them in a basic python implementation of a stack. Objects of Stack class ...
Ganesh Tata's user avatar
1 vote
1 answer
160 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 ...
Drosos-kal's user avatar
4 votes
1 answer
456 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) ...
Timur Shtatland's user avatar
1 vote
3 answers
91 views

Extensible error code infrastructure

I was answering a question, Java Exception Error Enumerations Anti-pattern, on Software Engineering Stack Exchange and found myself writing up a fair bit of code. It could use a code review so I'm ...
candied_orange's user avatar
1 vote
0 answers
163 views

Caching tasks and removing them from the cache when faulted [closed]

Is the code in Test1 and Test similar if it's being called like in RunAsync? The example is simplified, but this is an application with a high concurrency during ...
Dirk Boer's user avatar
  • 650
7 votes
1 answer
737 views

Wordle guesser, breaking out of loop by raising exception

After many years away from writing in Python, I am getting back into it. Specifically, I am trying to teach myself dataclasses. As an exercise I wrote a Wordle-solving program. I downloaded the ...
Richard D Lawson's user avatar
3 votes
1 answer
920 views

Class to wrap result or exception, similar to the OneOf approach

I recently came across the OneOf<T0,...,Tn> package from mcintyre321 via a video by Nick Chapsas, which presents the idea of holding exception types to be ...
JohnLBevan's user avatar
  • 1,409
3 votes
1 answer
932 views

Generic Scanner(System.in) Parsing

Often end up using a Scanner to grab some simple input and often when dealing with Number input it can result in a lot of little ...
Tim Hunter's user avatar
2 votes
1 answer
207 views

C++ exception class for error reporting, compatible with C++98 through C++20 (ver 2)

This question contains revised code from the question What should a C++ error reporting exception class have to be portable across language versions?. I summarize what is different from that code at ...
Scott McPeak's user avatar
8 votes
2 answers
318 views

What should a C++ error reporting exception class have to be portable across language versions? (ver 1)

Link to revised (ver 2) question This question contains the first version of the code for the task explained below. The revised version is at C++ exception class for error reporting, compatible with ...
Scott McPeak's user avatar
3 votes
1 answer
139 views

C++ exception handling

I'm getting throw exception and need your review The main function bellow trying to allocate memory several times and then throw the exception on the upper level. ...
Konstantin Vinogradov's user avatar
3 votes
2 answers
189 views

"Guess a random letter" game with command line interface

The code below if launched on the command line is a simple guessing game. A random character 'a', 'b' or 'c' is chosen, and the user is prompted until they guess correctly. It's arguable that invalid ...
Progrock's user avatar
  • 218

15 30 50 per page
1
2 3 4 5
9