Questions tagged [raise]
237 questions
14
votes
3 answers
Python, rasing an exception without arguments
I would like to know the best practice about raising an exception without arguments.
In the official python documentation, you can see this :
try:
raise KeyboardInterrupt
(http://docs.python.org/tutorial/errors.html chap. 8.6)
and in some…

Fabien Engels
- 363
- 1
- 5
- 15
14
votes
2 answers
Raising WPF MouseLeftButtonDownEvent event programmatically
I am trying to raise a MouseLeftButtonDownEvent by bubbling it up the Visual tree
with the following code.
var args = new MouseButtonEventArgs(Mouse.PrimaryDevice,0,MouseButton.Left);
args.RoutedEvent =…

TheWommies
- 4,922
- 11
- 61
- 79
13
votes
2 answers
Should the docstring only contain the exceptions that are explicitly raised by a function?
When writing doc strings in python, I am wondering if the docstring should contain the exceptions that are implicitly raised or if it should also contain the exceptions I explicitly raise.
Consider the function
def inv(a):
if a == 0:
…

Quickbeam2k1
- 5,287
- 2
- 26
- 42
12
votes
6 answers
Why is raising an NSException not bringing down my application?
The Problem
I'm writing a Cocoa application and I want to raise exceptions that will crash the application noisily.
I have the following lines in my application delegate:
[NSException raise:NSInternalInconsistencyException format:@"This should crash…

John Gallagher
- 6,208
- 6
- 40
- 75
12
votes
2 answers
Convert c# to vb.net 'RaiseEvent' statement to raise an event to use Gzip
I have convert class from c# to vb.net .. My point that I want to compress asp.net page to reduce the page size ,, Problem is after i convert to vb.net ,i have this error
Description: An error occurred during the compilation of a resource
required…

Mohammed Ali
- 696
- 3
- 9
- 22
12
votes
3 answers
How do I keep Visual Studio from autoraising, when I activate "Focus Follows Mouse"?
I'm running VS2008 and have used SystemParametersInfo to activate "Focus Follows Mouse" and "Do not Raise On Focus." Sadly though, VS2008 (with and without SP1) doesn't honour the "Do not Raise" part and eagerly pushes into the foreground every time…

David Schmitt
- 58,259
- 26
- 121
- 165
11
votes
2 answers
Python 'raise' without arguments: what is "the last exception that was active in the current scope"?
Python's documentation says:
If no expressions are present, raise re-raises the last exception that was active in the current scope.
(Python 3: https://docs.python.org/3/reference/simple_stmts.html#raise; Python 2.7:…

MarnixKlooster ReinstateMonica
- 9,640
- 14
- 54
- 108
11
votes
4 answers
How to cancel evaluating a required Ruby file? (a.k.a. top-level return)
file1 requires file2, and I want to be able to cancel evaluating file2 under certain conditions without exiting the whole process.
# file1.rb
puts "In file 1"
require 'file2'
puts "Back in file 1"
# file2.rb
puts "In file 2"
# return if…

user513951
- 12,445
- 7
- 65
- 82
11
votes
1 answer
CardView animation: raise and expand on click?
I'm currently in the process of creating my first android app, and was wondering what the method would be to set a cardview to raise up and then expand into a larger rectangle, revealing a new fragment?
edit: (the new fragment would fill up the…

Daniel Kim
- 267
- 3
- 16
11
votes
1 answer
Setting an exit code for a custom exception in python
I'm using custom exceptions to differ my exceptions from Python's default exceptions.
Is there a way to define a custom exit code when I raise the exception?
class MyException(Exception):
pass
def do_something_bad():
raise MyException('This…

Nir
- 894
- 3
- 13
- 24
10
votes
1 answer
Consider explicitly re-raising using the 'from' keyword pylint suggestion
I have a small python code in which I am using exception handling.
def handler(event):
try:
client = boto3.client('dynamodb')
response = client.scan(TableName=os.environ["datapipeline_table"])
return response
except…

ashakshan
- 419
- 1
- 5
- 17
9
votes
4 answers
What exceptions can be raised by action mailer
I had a look at the class but could not see a list of possible exceptions that can be raised from delivering smtp email in rails 3.
Has anyone any idea?

Niall
- 138
- 1
- 8
9
votes
6 answers
Raising Exception in TThread Execute?
I just realized that my exceptions are not being shown to the user in my threads!
At first I used this in my thread for raising the exception, which does not work:
except on E:Exception do
begin
raise Exception.Create('Error: ' +…

Jeff
- 12,085
- 12
- 82
- 152
9
votes
3 answers
EventHandler is null
I am trying to raise a click event from User control and handle it on the containing page. The problem I have is, when I click the button 'imgstep1' on the user control, the code behind imgstep1_click event triggers and but the 'btnHandler' event is…

jack
- 1,488
- 7
- 25
- 44
8
votes
5 answers
Raising external object's events in C#
If actions is a Panel, am I able to raise the Click event of it's parent?
I have this code at the moment, but the Click event isn't a method, so this code is invalid.
Does anyone know how I can achieve this?
actions.Click += delegate(object Sender,…
user47322