Questions tagged [raise]

237 questions
4
votes
2 answers

Is it possible to "hold" an event for later firing?

What I'm trying to do is: when the user presses a cancel button, or navigates away of the page through a link or a menu option, I check if there are unsaved changes. If so, I ask the user if he/she wants to save. I can't do this with a javascript…
Alejandro B.
  • 4,807
  • 2
  • 33
  • 61
4
votes
1 answer

how to raise an event when a value in a cell of a wpf datagrid changes using MVVM?

I need help with a wpf datagrid using the MVVM design pattern. I have a datagid that is bound to an observablecollection. The first column in the grid contains decimal values that cannot be edited. The second column contains a textbox into which a…
user823486
  • 139
  • 3
  • 9
4
votes
2 answers

Python only print traceback of raised exception

I'm raising a new exception in try-except block with additional message. The original exception traceback is therefore not needed anymore. Is there any way to remove the original traceback and only print the traceback of the newly raised…
Gab
  • 63
  • 6
4
votes
2 answers

Python 3 - raise statement

I am currently working through Learning Python by Mark Lutz and David Ascher and I have come across a section of code that keeps bringing up errors. I am aware that that book was written with Python 2 in mind unlike the Pyhton 3 I am using. I was…
user8048576
  • 63
  • 1
  • 1
  • 7
4
votes
3 answers

Ruby - how to raise same error for multiple methods without writing it multiple times?

Lets say I create a Calculator class that works by manipulating elements in an array - within this class I define several methods: add, subtract, multiply, divide. I want each method to raise the same error if there exist only 1 or fewer elements in…
Alex Kornfeld
  • 41
  • 1
  • 2
4
votes
3 answers

Python: Can I overload the raise statement with def __raise__(self):?

Here's my exception class that is using raise: class SCE(Exception): """ An error while performing SCE functions. """ def __init__(self, value=None): """ Message: A string message or an iterable of strings. …
orokusaki
  • 55,146
  • 59
  • 179
  • 257
4
votes
1 answer

ruby can't rescue or see abort from Thread.abort_on_exception

I need to immediately catch exceptions in threads and stop all threads, so I'm using abort_on_exception in my script. Unfortunately this means the exception is not raised to the parent thread - perhaps this is because the exception ends up…
4
votes
2 answers

Is it possible to raise an event on an object, from outside that object, without a custom function

public class a { public event eventhandler test; public void RaiseTest(){//fire test} } Is it possible to raise test on this class, from outside this class, without calling the method? Basically I have a large number of events which must be…
Jason Coyne
  • 6,509
  • 8
  • 40
  • 70
4
votes
1 answer

Delphi Re-Raise Exception (passed In Procedure as a parameter)

This is sample of re-raise exception and working well try raise Exception.Create('Exception msg'); except on E: Exception do begin if not(e is EConvertError) then raise; // re-raise exception end; end; and here…
user942514
4
votes
4 answers

How to disable all exception raising in Delphi?

Is there a way to disable all the dialog boxes when an exception or error occurs(like access violations, indy socket errors, timeouts etc.)? They are thrown sometimes in my program, but these errors aren't fatal in any way and can be ignored, just…
user1262737
  • 41
  • 1
  • 1
  • 5
3
votes
3 answers

Android: display x^y

Some help please! How can i display raised numbers in a TextView for Android.For example if you want to display some Celsius degrees you can do this:textview.setText(number+"\u2103") and your good to go but i can't find a way to do something like…
Faur Ioan-Aurel
  • 791
  • 1
  • 7
  • 18
3
votes
1 answer

Throwing Java exception in JRuby and catching it in Java

I have created my own UI component in Java. It has model and a few of model's methods can throw my exception called ModelException. I want to use this component in JRuby but I can't raise my ModelException: raise ModelException # it cause TypeError:…
guest
  • 1,696
  • 4
  • 20
  • 31
3
votes
5 answers

How do I subscribe to raised events and printing together?

I have been working on a program that has 3 classes of which 2 of the classes have timers that repeat at different intervals and once one "cycle" of the timer is done it raises an event with a string as return. The 3rd class subscribes to the events…
Csharpz
  • 885
  • 4
  • 15
  • 25
3
votes
1 answer

In the Raises section of the docstring of a function, should the exceptions raised indirectly be listed too?

For example, for: def foo(a): if a == 10: raise FooError return 1 / a Should the docstring for foo contain something like: """Raises: FooError: if a is equal to 10. ZeroDivisionError: if a is equal to 0. """ Or should it…
LoneCodeRanger
  • 413
  • 6
  • 18
3
votes
3 answers

Python exceptions - catching all exceptions but the one expected

I am working on a simple automation script in Python, which could throw exceptions in various spots. In each of them I would like to log a specific message and exit the program. In order to do that, I raise SystemExit after catching the exception…
prkist
  • 431
  • 5
  • 13