exception-handling

stored procedure exception handling in asp.net

Do i need to use try catch in my stored procedure to know where exactly in my procedure error has occured or can i achieve the same if i useSqlConnection.BeginTransaction in my ASP.NET form or simple try catch may be...??? I tried implementing try catch in my stored procedure..i m using sql server 2005 but it does not know TRY and CATCH...

Exception re-throwing through layers and usage of status codes

Hi all! I searched for this for a long time (here too), have read many php codes, but still couldn't find a satisfying answer. It may seem a too wide topic, but it really sticks together - at last for me. Could you please help? In a php website I have PDO as DAL, what is used by BLL objects, and they are called from the UI. Now if some...

stored procedure error handling

i have this procedure for inserting rows in tables(sql server 2005) CREATE PROCEDURE ans_insert ( @q_desc varchar(2000), @sub_id int, @marks int, @ans1 varchar(1000), @ans varchar(1000), @userid varchar(15), @cr_date datetime ) AS BEGIN BEGIN TRY BEGIN TRANSACTION DECLARE @q_i...

Math.sqrt(-5) -> Force Exception in JSP?

I've 3 .jsp files. index.jsp and sqrtcalculator.jsp and error.jsp. In index.jsp there's a text field and a button. In sqrtcalculator.jps there's the, well, calculator. Now, when I leave the field empty and press the button, an expection is called, because the field is empty. And I can then reroute to an individual error.jsp site to dis...

Rethrowing exception question

I read several posts on exception handling/rethrowing exceptions on here (by looking at the highest voted threads), but I am slightly confused: -Why would you not want the immediate catch block to handle an exception but rather something above it? -Also, I read quite frequently that you should only handle exceptions which you can "hand...

Math.sqrt(-5) -> Force custom exception & reroute and display error on custom error page

Since this not really answers my question, I'm gonna clarify. 3 .jsp pages, index.jsp, calculator.jsp and error.jsp. index.jsp contains (withoug html and body tags): <p><b>Enter the Number you want to know the square root of:</b></p> <form action="calculator.jsp" method="post"> <div><input type="text" name="number_textfield" size="40"...

How to determine whether a .NET exception is being handled?

We're investigating a coding pattern in C# in which we'd like to use a "using" clause with a special class, whose Dispose() method does different things depending on whether the "using" body was exited normally or with an exception. To the best of my understanding, the CLR keeps track of the current exception being handled until it's be...

Is there a CPAN module that allows me to manage errors ids and i18n error messages and integrates with Exception::Class or Error?

I am looking for a CPAN module that will allow me to store possible exceptions/errors in a database and internationalize my error messages. Currently I have subclassed Exception::Class but its a bit of a hack and I would like to use something that is production quality. It would be great if it integrates with Exception::Class or even Err...

python logging in django

Hi, I am using the basic python logger in django and it seems to be workng well. I have the logging setup in my setting.py as; logging.baseConfig(level = logging.NOTSET, format='a format', datemt=' a datefmt', filename='path to log', filemod...

How to catch BrokenRuleException in PLINQO?

I’ve created a custom rule by adding the static partial void AddSharedRules() { RuleManager.AddShared<Tag>( new CustomRule<String>( "TagName", "Invalid Tag Name, must be between 1 and 50 characters", IsNullEmptyOrLarge)); } to my Entity class. ...

Java: Exception in a child thread

in Java, if i start a thread T, from a main method in class A, and an exception occurs in T, how will the main method in A know about this. If im not wrong, an instance of Class A and the thread T will be present in two separate stacks, right, so, how does the parent of the thread get to know about the exception ? ...

I'm trying to catch and clear an error in ASP.net but I get redirected to "The connection to the server was reset while the page was loading"

Hello. I've got a page that lets you upload files. I've increased the maximum filesize to the desired level and that works but I would like to have customised error handling for when the user uploads something too big. All the guides I've found so far give advice on how to redirect to a specal error page, I can't find anything on how...

Forcing C++ compilers to check for exception handling

I was wondering if there is some compiler parameter, preferably in gcc (g++) which treats the lack of try/catch blocks as errors. This is the standard behavior in java and I was alway fond of it. ...

How to catch the null pointer exception ?

try { int* p = 0; *p = 1; } catch (...) { cout << "null pointer." << endl; } I tried to catch the exception like this but it doesn't work,any help? ...

Exception line-number in Jscript-ASP

Hello all, I'm developing a website with server-side JScript engine over ASP server. I have several try-catch clauses in my code looking roughly like this: try { // do something } catch (err) { // pass it to the frontend code die("Exception caught: " + err.description); } I would very much like to display the line number in ...

Is there an occassion where using catch all clause : catch (...) is justified?

Each time I have seen the catch all statement: try { // some code } catch (...) { } it has always been an abuse. The arguments against using cache all clauses are obvious. It will catch anything including OS generated exceptions such as access violations. Since the exception handler can't know what it's dealing with, in mo...

HandlerExceptionResolver for annotated controller.

I have annotated controller which contains several methinds mapped on urls. Like this: @Controller public class CategoryController { @RequestMapping(value = "/addCategories") public void addCategories(@RequestParam(value = "data") String jsonData) throws ParseException @RequestMapping(value = "/getNext") public void getNext(@RequestPa...

How to catch divide-by-zero error in Visual Studio 2008 C++?

How can I catch a divide-by-zero error (and not other errors; and to be able to access exception information) in Visual Studio 2008 C++? I tried this: try { int j=0; int i= 1/j;//actually, we call a DLL here, which has divide-by-zero } catch(std::exception& e){ printf("%s %s\n", e.what()); } catch(...){ printf("generic except...

what happens to ASP.NET exceptions from created non-threadpool thread?

Hi, In ASP.NET web application a worker thread creates a non-threadpool thread like below: private static bool _refreshInProcess = false; public delegate void Refresher(); private static Thread _refresher; private static void CreateAndStartRefreshThread(Refresher refresh) { _refresher = new Thread(new ThreadStart(refresh)); _r...

In C++, is there a difference between “throw” and “throw ex”?

I'd like to ask this question (also here), but this time about C++. What is the difference in C++ between try { /*some code here*/} catch(MyException& ex) { throw ex;} and try { /*some code here*/} catch(MyException& ex) { throw;} Is it just in the stack trace (which in C++ is in any case not a standard as in C# or Java)? (If i...