Questions tagged [exception]
An exception is a rarely occurring (exceptional!) condition that requires deviation from the program's normal flow.
129 questions
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 ...
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. ...
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 ...
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 ...
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 <...
2
votes
2
answers
275
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 ...
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 ...
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) ...
1
vote
3
answers
136
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 ...
7
votes
1
answer
770
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 ...
3
votes
1
answer
971
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 ...
3
votes
1
answer
974
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 ...
2
votes
1
answer
246
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 ...
8
votes
2
answers
370
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 ...
3
votes
1
answer
167
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.
...