Skip to main content

Questions tagged [exception]

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

5votes
2answers
169views

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 ...
jdc's user avatar
  • 153
0votes
3answers
175views

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. ...
Somesh Diwan's user avatar
1vote
1answer
187views

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
2votes
3answers
189views

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
3votes
1answer
229views

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
2votes
2answers
254views

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
2votes
1answer
170views

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
6votes
1answer
479views

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
1vote
3answers
107views

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
7votes
1answer
747views

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
3votes
1answer
945views

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
3votes
1answer
954views

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
2votes
1answer
222views

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
8votes
2answers
338views

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
3votes
1answer
152views

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

153050per page
close