error-handling

How to get MVC action to return 404

I have an action that takes in a string that is used to retrieve some data. If this string results in no data being returned (maybe because it has been deleted), I want to return a 404 and display an error page. I currently just use return a special view that display a friendly error message specific to this action saying that the item...

Avoid try/catch hell in my Telerik controls

I posted for some help over here: http://stackoverflow.com/questions/2945925/ I have added an 'override OnError' in a common base class from all my pages, and can confirm that it works properly by putting a breakpoint within the function. However, I still get an exception propagating to the client, no matter what I do. Here is my issue:...

Migrated to ASP.NET 4.0 on IIS 7 and can not get custom errors to work

I have an ASP.NET Web Application project that used to target ASP.NET 2.0. I installed ASP.NET 4.0 on the web server hosting the web application and changed the web application project to target .NET 4.0. Everything works ok with on exception: Custom Error Handling Before migrating to .NET 4.0, custom errors used to work. In my appli...

displaying sql exception in JSF

I was wondering how would I be able to show SQL errors generated during update, delete, select * etc in JSF. Any help would be appreciated. ...

SQL Server stored procedure return code oddity

Hello The client that calls this code is restricted and can only deal with return codes from stored procs. So, we modified our usual contract to RETURN -1 on error and default to RETURN 0 if no error If the code hits the inner catch block, then the RETURN code default is -4 rather then 0 Does anyone know where this comes from please?...

Only variables can be passed by reference

I had the bright idea of using a custom error handler which led me down a rabbit hole. Following code gives (with and without custom error handler): Fatal error: Only variables can be passed by reference function foo(){ $b=array_pop(array("a","b","c")); return $b; } print_r(foo()); Following code gives (only with a custom err...

ASP.NET MVC Error Handling - Remove aspxerrorpath

I'm working on some error handling in my MVC app, and I'd like to change asperrorpath to something that doesn't give away the fact that I'm using .NET... something like path Can anyone give me some direction on how to change that out? ...

C# -Why does System.IO.File.GetLastAccessTime return an expected value when the file is not found?

Please, explain your thoughts. 1. DateTime dt = System.IO.File.GetLastAccessTime("C:\\There_is_no_such_file.txt"); 2. DateTime dt = System.IO.File.GetLastAccessTime(""); If the file described in the path parameter does not exist, this method returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adju...

ERROR_INTERNET_SECURITY_CHANNEL_ERROR on MS IIS

I'm using MS IIS 6. And I have 3 https web pages: c1.aspx with a link to c2.aspx, this one has a Response.Redirect, on page load, to c3.aspx, where this last accepts client certificates. I'm using a smart card reader to get the certificate from a card. The problem is when I cancel the box to insert the PIN I receive an http response with...

Return PHP error constant (such as E_USER_ERROR) from function, or use trigger_error?

Which would you recommend? Return an error code, such as E_USER_ERROR from a function, and determine proper message higher up: function currentScriptFilename() { if(!isset($_SERVER['SCRIPT_FILENAME'])) { //This? return E_USER_ERROR; } else { $url = $_SERVER['SCRIPT_FILENAME']; $exploded = explode('/', $url);...

fieldWithErrors not wrapping every error field

Notice the following result when I submit blank :title and :description fields The validations are in the controller: class Question < ActiveRecord::Base validates_presence_of :title validates_presence_of :description And, the form is generated with those names: -form_for(@question) do |f| = f.error_messages = f.label :tit...

How to show why "try" failed in python

is there anyway to show why a "try" failed, and skipped to "except", without writing out all the possible errors by hand, and without ending the program? example: try: 1/0 except: someway to show "Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> 1/0 ZeroDivisionError: integer d...

IIS cannot serve pages ending with .config

This is obviously a security issue and probably do not want to change this, but it would be nice to handle the error. Any ideas? I see that stackoverflow is not immune: http://stackoverflow.com/questions/tagged/web.config They seem to have changed the tag to web-config to fix the problem but you still get a very nasty error message wh...

Strategies for Error Handling in .NET Web Services

I have a fairly substantial library of web services built in .NET that I use as a data model for our company web sites. In most .NET applications I use the Global ASAX file for profiling, logging, and creating bug reports for all exceptions thrown by the application. Global ASAX isn't available for web services so I'm curious as to what...

Difference between Resume and Goto in error handling block

I understand that in the following example a Resume statement should be used instead of a Goto statement. Sub Method() On Error Goto ErrorHandler ... CleanUp: ... Exit Function ErrorHandler: Log error etc Err.Clear 'Is this line actually necessary?' Resume CleanUp 'SHOULD USE THIS' Goto CleanUp 'SHOULD NOT USE THIS'...

How to tell Java SAX Parser to ignore invalid character references?

When trying to parse incorrect XML with a character reference such as &#x1, Java's SAX Parser dies a horrible death with a fatal error such as org.xml.sax.SAXParseException: Character reference "&#x1" is an invalid XML character. Is there any way around this? Will I have to clean up the XML file ...

Overriding PEAR error handler

Hi everyone, I'm currently working on an application that requires lots of external libraries. My job right now is set a unique error handler that will manage every error. So far, I found 7 different types of PEAR errors: PEAR_ERROR_RETURN: PEAR_ERROR_EXCEPTION: PEAR_ERROR_CALLBACK: PEAR_ERROR_PRINT: PEAR_ERROR_TRIGGER: PEAR_ERROR_D...

Is it possible to capture a "file not found" from another process and then return a file to that process?

I have a legacy application that looks for files in a directory. It does not handle missing files very well. What I want to do is "capture" the file not found errors, and send another file back to the calling app instead. Similar to how you could handle a 404 error on a webserver and return something based on what the requested URL was...

get a text from the error code returns from the GetLastError() function

Hi, I need to get the text of an error code that i got from the GetLastError function. I saw a few examples but i want a function that get the code and return the string. Thank's you all ...

Does SQL Server 2005 pass error message numbers back to the asp.net application?

I'd like to get the message number and severity level information from SQL Server upon execution of an erroneous query. For example, when a user attempts to delete a row being referenced by another record, and the cascade relationship is "no action", I'd like the application to be able to check for error message 547 ("The DELETE stateme...