Questions tagged [custom-error-handling]

171 questions
1192
votes
36 answers

Reference - What does this error mean in PHP?

What is this? This is a number of answers about warnings, errors, and notices you might encounter while programming PHP and have no clue how to fix them. This is also a Community Wiki, so everyone is invited to participate adding to and maintaining…
hakre
  • 178,314
  • 47
  • 389
  • 754
120
votes
19 answers

Null check chain vs catching NullPointerException

A web service returns a huge XML and I need to access deeply nested fields of it. For example: return wsObject.getFoo().getBar().getBaz().getInt() The problem is that getFoo(), getBar(), getBaz() may all return null. However, if I check for null in…
26
votes
2 answers

Is it possible to use a Relative path when setting a custom error page in IIS7?

I'm trying to set a custom 404 error page for my web application. The trouble is that this application will be deployed to a number of different environments. Sometimes it will be in a virtual directory and sometimes it won't. I have the error page…
Martin Brown
  • 22,802
  • 13
  • 71
  • 107
12
votes
1 answer

Add extra properties in Custom Exception to return to AJAX function

I have a custom exception class as follows: Public Class SamException Inherits Exception Public Sub New() ' Add other code for custom properties here. End Sub Public Property OfferBugSend As Boolean = True …
10
votes
1 answer

Nginx, PHP + FPM Custom Error Pages

I am trying to create some custom error pages but can't seem to get the 500 one working. I have the following config: server { listen 80; root /var/www/devsite; index index.php; server_name devsite; error_page 403 =…
Ken
  • 479
  • 4
  • 16
8
votes
6 answers

How to avoid “memory … exhausted” error when using debug_backtrace() in custom error handler?

I wrote an error handler for my website that looks like this: function errorHandler($number, $string, $file, $line, $context, $type = '') { // save stuff in DB } Which I register like this: set_error_handler('errorHandler', E_ALL); I save all of…
Nate
  • 22,356
  • 31
  • 115
  • 196
8
votes
1 answer

nginx error location for all servers

Is it possible to define a common location for all servers? From nginx location documentation I've seen that location depends on server. I would like to do something like this: ... http { error_page 404 /error/404.html; …
Miquel
  • 7,052
  • 6
  • 49
  • 75
7
votes
1 answer

Is there a way to change HttpWebRequest behavior on 400/500 status codes?

I am working on building a fluent REST client interface on top of the HttpWebRequest/HttpWebResponse types in .NET. So far, so good...however I am trying to develop a pluggable security framework that can automatically handle security token…
jrista
  • 30,956
  • 13
  • 83
  • 126
6
votes
2 answers

Handling error codes from multiple libraries in C

Very often, I have to use multiple libraries that handle errors differently or define their own enums for errors. This makes it difficult to write functions that might have to deal with errors from different sources, and then return its own error…
6
votes
1 answer

WCF Routing Service - Dynamic Error Handling

I'm learning about what can be done with the WCF Routing Service. Still at the 'screwing around with it to see what it can do' phase. My understanding of the Routing Service is that when a message comes through, the service will try to pass it on to…
Daniel Schealler
  • 382
  • 1
  • 15
5
votes
2 answers

Customized error responses for ApiVersioning errors in webapi dotnet core

I am creating a package lib for all the errors in a Webapi service. This library will be used for providing custom responses for BadRequest, BadArgument, ApiVersionsing etc.. related errors. I need help in customizing Apiversion related errors for -…
4
votes
1 answer

Windows 7 - Disable Close Program/Debug Program Dialog, yet crash dump and notify the user

I'm developing a commercial Windows 7 desktop application (somewhat shrink wrap, but not quite). The application has both Windows Service and a WPF User Interface components. In the event that our application fails at a customer site we want to be…
4
votes
0 answers

How to Override Global Error Handler by some methods in angular 7

I have implemented Global error handling in my Angular 7 application which is working fine to handle all errors. export class RequestInterceptor implements HttpInterceptor { intercept(request: HttpRequest, next: HttpHandler):…
4
votes
1 answer

Angular custom error handler not getting error type from promise

When thrown from a promise every Error my custom error handler is getting does loose its type import { HttpErrorResponse } from "@angular/common/http"; import { ErrorHandler, Injectable, Injector, NgZone } from "@angular/core"; import { MatSnackBar…
DasEarl
  • 231
  • 1
  • 2
  • 11
4
votes
3 answers

.Net Core 2.x Redirect to Error Page

I have a simple ASP.Net Core 2.0 web application and I have enabled Windows Authentication in project property by enabling Windows Authentication and disabled Anonymous Authentication. For Authorization at Application/Site level filtering by AD…
1
2 3
11 12