custom-error-handling

Nginx, PHP + FPM Custom Error Pages

百般思念 提交于 2019-12-30 08:25:12
问题 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 = /error.php?code=403; error_page 404 = /error.php?code=404; error_page 500 = /error.php?code=500; location / { try_files $uri =404; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } } At first, I

Null check chain vs catching NullPointerException

≡放荡痞女 提交于 2019-12-27 11:03:43
问题 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 all cases, the code becomes very verbose and hard to read. Moreover, I may miss the checks for some of the fields. if (wsObject.getFoo() == null) return -1; if (wsObject.getFoo().getBar() == null) return -1; // maybe also do something with

Error handling in WPF PasswordBox

妖精的绣舞 提交于 2019-12-24 01:59:14
问题 I have always admired the way Josh Smith has built his sample application. And I have also tried to emulate the way in which the ViewModels of his application implements the IDataErrorInfo property and through a custom DataTemplate renders the errors before the user. Here is the data template that he uses to show the error: <DataTemplate DataType="{x:Type ValidationError}"> <TextBlock FontSize="10" FontStyle="Italic" Foreground="Red" HorizontalAlignment="Right" Margin="0,1" Text="{Binding

WCF Routing Service - Dynamic Error Handling

喜夏-厌秋 提交于 2019-12-23 09:31:51
问题 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 whichever endpoint appears first in the backup list. If that fails, it will then go on to try the next, and then the next, until either something works or there's nothing left to try. What I would like to do is get access to that failure event so

Customized error responses for ApiVersioning errors in webapi dotnet core

北城以北 提交于 2019-12-13 16:22:57
问题 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 - ApiVersionUnspecified, UnsupportedApiVersion, InvalidApiVersion, AmbiguousApiVersion. I have follow this article to include api-versioning for my project - https://www.hanselman.com/blog/ASPNETCoreRESTfulWebAPIVersioningMadeEasy.aspx I have

How to found out url with which the request arrived at error handler?

萝らか妹 提交于 2019-12-10 10:42:43
问题 I send following http request: http://localhost:8081/member/createCompany/getSmallThumbnail/ On server side I hit into controller method: @RequestMapping("/error") public String error(Model model, HttpServletRequest request){ if(request.getRequestURI().contains("thumbnail")){ System.out.println("thumbnail accepted"); } request.toString(); model.addAttribute("message", "page not found"); return "errorPage"; } At this method I want to know url with which the request arrived. If in debug I stop

How can I catch ALL errors in PHP?

可紊 提交于 2019-12-05 09:35:12
问题 I've found a lot of attempts at all-inclusive error handling implementations, and I figured I might write up a wiki-style to hopefully provide a complete solution that I came up with. The question is: "How might one catch, handle, or intercept ALL error types in PHP?" Now - this might be deemed a 'rewrite' by some - but I don't know that there's been a comprehensive solution proposed. 回答1: There are three kinds of error handlers you need: set_exception_handler, to catch any otherwise uncaught

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

爷,独闯天下 提交于 2019-12-04 22:19:45
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 in a directory called ErrorPages and have set up my config like this: <httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCode="404"/> <error statusCode="404" path="/VirtualDir/ErrorPages/404.aspx" responseMode="ExecuteURL" /> </httpErrors> </system.webServer> The trouble is when I deploy this to the root of a web site, the

A potentially dangerous Request.QueryString value was detected from the client [duplicate]

冷暖自知 提交于 2019-12-02 00:47:11
问题 This question already has answers here : A potentially dangerous Request.QueryString value was detected from the client when sending html markup from jquery post call to asp.net page (5 answers) Closed 4 years ago . I'm using WebForm I'm doing a Security Testing to my site but when I try to pass through url a QueryString like: '"-->netsparker(0x00286A) mysite/Error/PageNotFound.aspx?aspxerrorpath=%27%22--%3E%3C/style%3E%3C/script%3E%3Cscript%3Enetsparker(0x0030C5)%3C/script%3E I got Server

Null check chain vs catching NullPointerException

跟風遠走 提交于 2019-11-26 16:02:26
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 all cases, the code becomes very verbose and hard to read. Moreover, I may miss the checks for some of the fields. if (wsObject.getFoo() == null) return -1; if (wsObject.getFoo().getBar() == null) return -1; // maybe also do something with wsObject.getFoo().getBar() if (wsObject.getFoo().getBar().getBaz() == null) return -1; return wsObject