I have a script in production - an ecommerce checkout page - that has had some errors in the past that have prevented it from working and have cost me money. I wanted to get notified on errors so I worked this up:
<?php
function mailErrorHandler($errno, $errstr)
{
echo "<!--PHP ERROR:";
echo "---[$errno] $errstr ---";
echo "-->...
I'm trying to standardize the way I handle exceptions in my web application (homemade framework) but I'm not certain of the "correct" way to handle various situations. I'm wondering if there is a best practice from UI/ user-friendly point of view.
User logs into application and opens two tabs showing the same screen. On one tab they ...
Hi,
I just tried to redirect nonexistent files on the server to my custom 404 page but it only redirects .html files.
I used that in my .htaccess file:
ErrorDocument 404 /404/404.html
How can I redirect all nonexistent files (including .php) to my custom page?
Thanks
...
I am using __autoload() which simply looks like this:
function __autoload($class_name) {
require_once($class_name . '.class.php');
}
When the error reporting is E_ALL it works fine. The class is loaded, and the script runs without errors.
When the error reporting is E_ALL | E_STRICT, no pages work, I simply get:
"Fatal error: Clas...
I'm looking for a way to continue execution of a transaction despite errors while inserting low-priority data. It seems like real nested transaction could be a solution, but they aren't supported by SQL Server 2005/2008. Another solution would be to have logic to decide if an error is critical or not, but it would seem that's not possibl...
I'm currently using Google Analytics Event Tracking to track user interface interactions in my web application.
Since our system doesn't currently have a way to log client side errors, as a quick fix I've put event tracking code in catch blocks and web service error handlers.
Does anybody else do this? Is it effective, or would you re...
I've stopped receiving error messages in my CakePHP app. Normally error messages are suppressed if you have debug set to 0; if it is 1 or 2 then you get the error message, (plus stack trace, etc.) But I don't get anything if there is an error, regardless of my debug setting. So if I introduce an error (syntax, logic, whatever) all I get ...
i get this strange error while ruining my program with Visual C++ 2008 Express Edition:
'Ex2.exe': Loaded 'D:\studyMA\c++\visual studio\Ex2\Ex2\Debug\Ex2.exe', Symbols loaded.
'Ex2.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'Ex2.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'Ex2.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.Deb...
Say my program attempts a read of a byte in a file on a ZFS filesystem. ZFS can locate a copy of the necessary block, but cannot locate any copy with a valid checksum (they're all corrupted, or the only disks present have corrupted copies). What does my program see, in terms of the return value from the read, and the byte it tried to rea...
File file = new File(path);
if (!file.delete())
{
throw new IOException(
"Failed to delete the file because: " +
getReasonForFileDeletionFailureInPlainEnglish(file));
}
Is there a good implementation of getReasonForFileDeletionFailureInPlainEnglish(file) already out there? Or else I'll just have to write it myself.
...
I have a datagridview that seems to be working fine until the user adds a name into the unique name column that already exists.
I am getting this:
System.Data.ConstraintException: Column 'Name' is constrained to be unique. Value 'test' is already present.
Any suggests as to where and how I capture this error and prevent the users fro...
I've heard this on the Internet. For instance, Google's Go language has no exceptions as a design choice, and Linus of Linux fame has called exceptions crap. I am just wondering why?
...
To the point: how would you handle a server-side HTTP 4nn/5nn errors in jQuery's ajax requests? This case concerns a JSP/Servlet webapplication at the server side. Here I am not talking about trivial runtime exceptions such as NullPointerException and so on. Assume that they're all handled perfectly. A good example of such a HTTP 4nn/5nn...
I'm converting my code from using Handler to AsyncTask. The latter is great at what is does - async updates and handling of results in the main UI thread. What's unclear to me is how to handle exceptions if something goes haywire in AsyncTask#doInBackground? The way I do it is to leave error Handler and send message to it. It works fine ...
I need to be able to instantiate an object of a class in Dojo at runtime and mix it into another object (kind of like specifying an extends or an implements in Java, but at runtime). and I came up with the following solution:
var declaredClassBackup = this.declaredClass; // backup the "declaredClass"
var mixinObject = null;
try {
...
What is the best way to have a (Java) program recognize it crashed last time it ran and show a message along the lines of "it looks like this program crashed on you last time. Report this problem here: [email protected] ...."
Is there a recommended way of doing this? (Bad?) ideas I had would be:
Have the program store a temporary key file a...
I had an exception in some code today: "A [some exception] was unhandled."
However, this code was clearly inside the "try" block of a "try/catch" structure.
What am I missing here?
Update: It's C#
Update: Oh, forget it. It turns out the specific mechanism of error is that I'm an idiot. There's no fix for this.
...
Is there anyway to recover gracefully in an ASP.NET MVC application if the database is not found for some reason when I try to get an instance of my NHibernate Session from Structuremap?
public static class StructureMap
{
private static Configuration Cfg
{
get
{
var configuration = new Configuration()...
Almost every controller action looks up one or more entities based on some user input. For some time I've been wanting to remove some of this boring, dry-breaking, boilerplate code:
def show = {
def entity = null
if (params.id && params.id.isLong() && params.id.toLong() >= 0)
entity = Book.get(params.id.toLong())
if (!e...
Hi,
In my application I am loading xml from url in order to parse it.
But sometimes this url may not be valid. In this case I need to handle errors.
I have the following code:
$xdoc = new DOMDocument();
try{
$xdoc->load($url); // This line causes Warning: DOMDocument::load(...)
// [domdocument.load]: failed to op...