Hey guys,
I'm currently working on a project and I've come upon a bit of a head scratcher. I've been programming in Java for about two years, and I've covered exceptions, but never properly understood them.
In my current situation I've got my main method which initializes a class
WikiGraph wiki = wiki = new WikiGraph(getFile());
Th...
How to make error handlers in Lift? I have html page with some snippets, if one of those snippets throws an exception I want to catch it and redirect to some user friendly error page.
How to do this in catch-all manner? I do not want to put error handling to each snippet separately. I am looking something like this in Wicket.
...
Hi
I'm starting a new project, a end-user desktop application. I'm a concerned about what will happened if (ok, when) the end-user gets an unhandled exception.
Asking the user to help me reproduce the bug is not an acceptable option.
As I see it I'm left with one option: to upload an error report to my server.
Years ago when I were a...
I would like to write a SQL script that executes multiple individual SQL statements; if any of those statements fail, I'd like to rollback the entire transaction. So, something like:
BEGIN TRANSACTION
insert into TestTable values (1)
insert into TestTable values (2)
insert into TestTabe values (3)
--if any of the statements fail
ROLL...
Is there an easy way to trap all exceptions inside all UI event callbacks instead of calling try/catch in each callback?
Here's what I tried so far:
UI Callback:
private void btnOk_Click(object sender, EventArgs e)
{
int x=0;
int i=1/x;//Exception happens here.
}
entry point:
public static void Main(string[] args)
{
try
{...
For example, if I'm opening a file, I know a FileNotFoundException might happen, or if I'm converting a String to double, a FormatException may happen. Obviously, if a method does both, both can be raised.
Is there a way to quickly see all possible exceptions raised by a method though? Keeping track of it myself seems error prone.
...
When in debug mode, powerbuilder (ver 10.5) throws application execution error and terminates the application, for errors raised by statements put inside try/catch blocks?
For example line 3 below throws, an "array boundary exceeded" error and the application is terminated. How can I overcome this (handled) error and debug the rest of t...
I'm working on a small but vital batch application which has a step in it to download an image from a remote website I don't have any control over. This is quite simple and I got it working already but I'd like some input on the error-handling.
The remote server doesn't always have the image requested so a 404 Not Found is actually alri...
Hello,
I am trying to get a user to enter a number between 1 and 4. I have code to check if the number is correct but I want the code to loop around several times until the numbers is correct. Does anyone know how to do this? The code is below:
def Release():
try:
print 'Please select one of the following?\nCompletion = 0...
Hi there,
I want to create an error class. And it has some static properties. For example : Message, InnerException, Stacktrace, Source. But i want to add some dinamiclly properties. If exception is a FileNotFoundException, i want add FileName property. Or if it s a SqlException, want to add LineNumber property. And i cant inherit that ...
Hello all,
I'm writing a custom error-handling method, and am passing it an Exception object. I need to be able to access that Exception's ExceptionContext object, so I can set a property to true before I execute the Error view. Does anyone know how to get to the ExceptionContext, given just an Exception object?
For reference, the reas...
Hi there,
I have a themed page whereby the theme is chosen inside a http module.
public void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
Page p = HttpContext.Current.Handler as Page;
if (p != null)
{
//get theme
string theme = GetTheme(HttpContext.Current.Request.Url.Host);
Debu...
I've found several C# application crashes in response to error conditions such as obj = null or obj.member = null. A lot of time, the obj from the interface of 3rdPartyApp.
And caused both 3rdPartyApp and MyCsApp crashed together.
How could I add exception handling in all possible areas so that my application can survive in these disast...
Imagine a web service with a method that returns a Customer object, that takes a customer ID as a parameter, i.e.
[WebMethod]
Customer GetCustomer(string customerId)
Now imagine that you're writing an ASP.NET app and you've generated a proxy for the service with the async operations. You create an instance of the service, wire servic...
What is the right way to handle exceptions thrown from inside a DLL in Delphi?
Something like this
on E : ESomeException do ...
or
if (E is ESomeException) then ...
fails, because of the separate type registries of the DLL and the main application.
...
I have following situation (simplified, of course):
MyDomain.groovy:
class MyDomain {
MyAnotherDomain anotherDomain // lazy loaded
}
MyService.groovy:
class MyService {
boolean transactional = true
def doSomething(id) {
// ... some code...
}
}
MYController.groovy:
class MyController {
def myService
def doAction = {
...
In my WCF client class I'm handling the Faulted() event so that if the remote service throws an exception and faults the channel I can still at least shut it down gracefully. Here's my code:
protected void RemoteDataRetriever_Faulted(object sender, EventArgs e)
{
(sender as ICommunicationObject).Abort();
this.Dispose();
thro...
I seem to be having a brain freeze. I want to catch a possible Ruby exception during a loop through several objects in order to count it as a failure for displaying later, but I do not want execution halted; I want it to skip the bad record and continue. How do I do this again? I don't think I can use retry because that would try the ...
I cooked up a class ExceptionHandler<T extends Exception, OptionalReturnType> (see below) to eliminate some (what I view as) boilerplate code which was cluttering up actual implementation, while still providing a hook for explicit Exception handling if desired in the future. For the most part, in my application (essential a scientific c...
I've looked at how shadowhand (the main guy behind Kohana currently) set up his bootstrap.php file to handle exceptions on GitHub.
I thought, "that's cool", so I incorporated something similar.
However, instead of serving up a view, I'd like to send the request to a different route (or at least point it to a controller/action pair).
S...