Hello! I have made a function that connects to a models 'pre_save' signal. Inside the function I am trying to check if the model instance's pk already exists in the table with:
sender.objects.get(pk=instance._get_pk_val())
The first instance of the model raises an error. I catch the error and generate a slug field from the title. In a...
Hi All,
I want to know if check for return codes for all of functions that we write for production environment.
for e,g, i use C a lot and do u catch the return codes for the standard library also, not just the functions that you write , but the 3rd party API/standard library/any other library.
Most code i see in production do not do t...
I'm using a try-catch block in the following Actionscript 3 code:
try {
this._subtitle = new SubtitleController(subtitlePath, _framerate);
this._subtitle.addEventListener(Event.COMPLETE, subtitleLoaded);
}
catch (e:Error) {
trace('subtitle not found');
}
The SubtitleController constructor then tries to load the subtitlePat...
I'm using a background worker in order to get data from a database. My problem is that I'm struggling to report any errors in the database activity.
I've tried straight up spawning a Dialog (Windows Form that I've created) from the DatabaseUpdater class. However, this hangs and I'm left with a white box instead of the error message. I'v...
What do you do if you're error logging code fails?
How do you make sure that its currently working?
How do you know if its not working?
How do you test that its working in a production environment?
Should I throw an exception if all else fails?
The code below uses Microsoft's Enterprise Library Logging Application Block. How do you m...
I'm writing a COM object in C# and I'd like to raise errors to vba/asp client software using the mechanism it understands - the Err object.
In good ol' days that would have meant implementing ISupportErrorInfo on the COM object but I can't find any information about how to implement that interface in a C# object.
Can anybody help?
tha...
On the front page for MooTools, it says:
MooTools code respects strict
standards and doesn't throw any
warnings.
I like MooTools, but having recently read The art of throwing JavaScript errors, I'm a bit confused as to why 'not throwing any warnings' is a feature. If a library doesn't tell you when there's an error (which may b...
I've made the changes outlined at http://stackoverflow.com/questions/108813/404-http-error-handler-in-aspnet-mvc-rc-5 and I'm still getting the standard 404 error page. Do I need to change something in IIS?
...
Hi!
I found out, while shoulder surfing some other - much more experienced programmers - that they all have different strategies in finding (their) errors in (their) code.
And I don't mean understanding compiler error messages, but understanding the reason why the error message occurs - immediately by following the code-flow and locat...
I am attempting to implement gobal error handeling, in my MVC application.
I have some logic inside my Application_Error that redirects to an ErrorController, but its not working.
I have a break point inside my Application_Error method in the the Global.aspx.
When I force an exception the break point is not being hit. Any idea why?
...
How do I implement error handling elegantly? For example, my data access layer can potentially throw 2 types of errors:
1) not authorized access, in which case the page should hide everything and just show the error message
2) errors that inform the user that something like this already exists in the database (say name not unique - for e...
We have a large application mainly written in SQL Server 7.0, where all database calls are to stored procedures. We are now running SQL Server 2005, which offers more T-SQL features.
After just about every SELECT, INSERT, UPDATE, and DELETE, the @@ROWCOUNT and @@ERROR get captured into local variables and evaluated for problems. If the...
I am interested to see how other people have implemented flexible error handling. I will explain what I need specifically.
We all know that we can use exception wrapping (and catch it later where needed).
However, what I would like to implement (and elegantly) is distinguishing the types of errors after the stored proc is invoked.
I...
This is a follow-up question to Is there a difference between “throw” and “throw ex”?
is there a way to extract a new error handling method without resetting the stack trace?
[EDIT]
I will be trying both "inner method" and another answer provided by Earwicker and see which one can work out better to mark an answer.
...
So I have an abstract data type called RegionModel with a series of values (Region), each mapped to an index. It's possible to remove a number of regions by calling:
regionModel.removeRegions(index, numberOfRegionsToRemove);
My question is what's the best way to handle a call when the index is valid :
(between 0 (inclusive) and the ...
Hi
I have always had issues with identifying the errors in applications from the error reports I get. Currently I build an email with information about the error containing.
User
Url
Error Message
Time And Date
This is the code I use
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim _UserIpAddress as stri...
Brian Kernighan was asked this question in a recent interview. I'll quote his reply:
Brian: I'm torn on this. Error-handling code tends to be bulky and very uninteresting and uninstructive, so it often gets in the way of learning and understanding the basic language constructs. At the same time, it's important to remind programmers ...
I was wondering if there was a better way of handling the case in C where you want to exit a function as soon as you encounter an error in a series of expressions. (in this case, its a function that returns a NULL on error)
e.g. in some C code where they tried to short circuit error handling by combining a series of statements with AND...
What is the closest you can get to a try-catch block in php4?
I'm in the middle of a callback during an xmlrpc request and it's required to return a specifically structured array no matter what.
I have to error check all accesses to external resources, resulting in a deep stack of nested if-else blocks, ugly.
...
I'm currently using an Open Session in View pattern in an ASP.NET WebForms application (adapted quite a bit from Billy McCafferty's http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx). To oversimply state what goes on here:
Open NHibernate transaction at beginning of request
Commit at end of request (rolling back o...