error-handling

ASP.NET : Get URL of error page in global.asax's Application_OnError

I have an ASP.NET application where i am tracking my applicaion level erros using golabl.asax On_Error method.I will send an email to my id when there is some error happened in the site(ie :" when the application _error being invoked) Now From my global.asax's Application_OnError event, how can i get the URL of the page where this error ...

Best Practices: Handling disconnects of hardware in classes that represent them

Hello, I'm working in VB.Net developing data logging software. I've developed classes implementing a common interface that works with many of the data loggers my company produces. These classes handle the low-level hardware interfacing and expose common methods for accessing the data logger's records. My issue is what would be a good...

How to produce an HTTP 403-equivalent WCF Message from an IErrorHandler?

I want to write an IErrorHandler implementation that will handle AuthenticationException instances (a proprietary type), and then in the implementation of ProvideFault provide a traditional Http Response with a status code of 403 as the fault message. So far I have my first best guess wired into a service, but WCF appears to be ignori...

Web services error trapping(Jquery + asp.net web service)

I am on the look out for an accepted solution for trapping errors in the following scenario: i have an asp.net web services that interacts with the database. I interact with the web service through jquery's $ajax function. I would like to know what is the accepted stable methodology for error trapping. When the data is received from th...

ELMAH - Using custom error pages to collecting user feedback

Hey guys I'm looking at using ELMAH for the first time but have a requirement that needs to be met that I'm not sure how to go about achieving... Basically, I am going to configure ELMAH to work under asp.net MVC and get it to log errors to the database when they occur. On top of this I be using customErrors to direct the user to a fri...

How can I best deal with problems when initializing a model in an iphone app?

So assume I have a class that has an init method that does something like... grabs some data off the net in xml format and parses it to initialize some of its properties. My concern is how should I handle the case where the network is down or the xml data my object receives is bad? Normally in C i would use return values to indicate an...

how do I stop further methods in a PHP class?

I am learning OOP with PHP. I am creating a class to extract XML data from a website. My question is how do I stop the given object from executing more methods if there is an error with the first method. For example, I want to send the URL: class GEOCACHE { public $url; public function __construct($url) { $this->url=$url...

best approach for Logging/Error Handling framework for a C# .NET v3.5 application? (enterprise library / log4net / ?)

Hi, I'm working on a .NET v3.5 winforms app and would like to leverage some support for: a) logging (to file & to perhaps windows events) b) error handling / exception handling framework - to assist in distinguishing messages that can be shown to user versus handled within the code and logged c) a bonus extra would be how to capture/...

Skipping exceptions when using map in Haskell

Hi I have the following code to return the length of a cycle in a string: module Main where import Data.List detec ys n | 2*n > (length ys) = error "no cycle" | t == h = (2*n - n) | otherwise = detec ys (n+1) where t = ys !! n h = if n == 0 then ys !! 1 else ys !! (n*2...

R: catching an error and then branching logic

How do I write R code that allows me to execute a different path in my code if an error condition happens? I'm using a function that tends to throw an error. When it meets an error condition I would like to execute a different function. Here's a specific example: require(SuppDists) parms <- structure(list(gamma = -0.841109044800762, del...

Reliably read value of PHP display_errors

In my PHP error handler I want to do something like: if (ini_get('display_errors') IS ON)) { // show debug info } else { // show just "oops!" } I've look through the docs and stuff, but I can't really find out what the possible values for display_errors are (such as "on", 0, "Yes") and what it does for what value. What should I put ...

TSQL make trigger fail silently

I have some code in an after insert trigger that may potentially fail. Such a failure isn't crucial and should not rollback the transaction. How can I trap the error inside the trigger and have the rest of the transaction execute normally? The example below shows what I mean. The trigger intentionally creates an error condition with th...

Sql Server error catching

Hi, Does anyone know of a way to capture an error message returned from a linked server? As an example, if i run the following command in SQL Server management studio: BEGIN TRY exec ('select * from xxx') at my_linked_server END TRY BEGIN CATCH print 'ErrorNumber...'+ CAST(ERROR_NUMBER() as varchar) print 'ErrorSeverity...'+ ...

How do I setup a basic VB.NET WinForms application

Hi, I'm want to write a professional application for resale. I need to know how do I setup a WinForms application with effective error handling? ...

Why are assertions compiled out of production builds (other than performance)?

The typical argument for removing assertions from production code is performance. This doesn't make sense to me. Yes, stripping a few assertions out of the performance-critical 5% or so of your code can be a useful optimization. For the other 95%, though, they probably have no measurable effect, and asserts can only increase the likel...

What is the best way to get the URL of a 404'd file after redirect?

Hello all, I'm working with a PHP site that needs to log errors to a database. As such, I've set up a .htaccess file as follows: ErrorDocument 404 /404.php 404.php contains all of the logging functions necessary to insert the log into the database. What I'm having problems with is retrieving the URL of the file that triggered the 40...

Objective-C: Best way to store error messages

What's the best way to store error messages (specially while developing with Xcode and Objective-C for Mac and iPhone): Creating a separate class that contains list of error code and corresponding messages .plist of error code and corresponding messages Localizable.string file with error code and corresponding messages (the applicati...

Error interface in cpp

I am designing a software that has two logical layers, say A and B. Layer B has set of objects (classes). Layer A uses set of APIs exposed by layer B objects for information retrieval. I want to design a generic error interface across layer B objects that can be exposed to layer A. What would be the best way to write a generic error inte...

Exception reporting frameworks for Cocoa

Hi, Are there any frameworks that capture and report exceptions? I need something that catches any exceptions or errors caused by my program while its being used by a non-technical user and then to email it to me. Do you handle this on your own projects? Did you roll your own solution or is there an off the shelf solution? Any help wou...

Is it okay for constructors to throw runtime exceptions?

When checked exceptions are thrown from methods in a constructor that the constructor can't handle is it okay to catch them and throw them back out as a runtime exception if your sure the application can't handle it and will be useless without the object being constructed? ...