tagged [error-handling]

Powershell: How can I stop errors from being displayed in a script?

Powershell: How can I stop errors from being displayed in a script? When my PowerShell script tries, for example, to create a SQL Server object for a server that doesn't exist ("bla" in my case), Powe...

6 Dec at 12:15

ServiceStack - How to return ResponseDTO from RequestFilter?

ServiceStack - How to return ResponseDTO from RequestFilter? I am using a RequestFilter for pre-processing some of the messages to a web service, and if there are errors I want to return a ResponseDTO...

28 Feb at 17:6

Why is "except: pass" a bad programming practice?

Why is "except: pass" a bad programming practice? I often see comments on other Stack Overflow questions about how the use of `except: pass` is discouraged. Why is this bad? Sometimes I just don't car...

C# -Why does System.IO.File.GetLastAccessTime return an expected value when the file is not found?

C# -Why does System.IO.File.GetLastAccessTime return an expected value when the file is not found? Please, explain your thoughts. 1. If the file described in the path parameter does not exist, this me...

4 Jun at 07:46

How can I catch a 404?

How can I catch a 404? I have the following code: How can I catch a specific 404 error? The WebExceptionStatus.ProtocolError can only detect that an error occurred, but not give the exact code of the ...

How to handle ETIMEDOUT error?

How to handle ETIMEDOUT error? How to handle etimedout error on this call ? ``` var remotePath = "myremoteurltocopy" var localStream = fs.createWriteStream("myfil");; var out = request({ uri: remo...

Deploying website: 500 - Internal server error

Deploying website: 500 - Internal server error I am trying to deploy an ASP.NET application. I have deployed the site to IIS, but when visiting it with the browser, it shows me this: > Server Error500...

20 Jun at 09:12

Disabling Strict Standards in PHP 5.4

Disabling Strict Standards in PHP 5.4 I'm currently running a site on php 5.4, prior to this I was running my site on 5.3.8. Unfortunately, php 5.4 combines `E_ALL` and `E_STRICT`, which means that my...

26 Apr at 22:1

try-catch blocks with the return type

try-catch blocks with the return type If I have a method that returns something, like This produces compiler error, obviously because `catch{}` block does not return anything. So when I have methods w...

2 Mar at 15:21

Where does PHP store the error log? (PHP 5, Apache, FastCGI, and cPanel)

Where does PHP store the error log? (PHP 5, Apache, FastCGI, and cPanel) I am on shared hosting and have [cPanel](https://en.wikipedia.org/wiki/CPanel), Apache, and PHP is run by [FastCGI](https://en....

26 Sep at 13:40

When is it appropriate to use error codes?

When is it appropriate to use error codes? In languages that support exception objects (Java, C#), when is it appropriate to use [error codes](http://en.wikipedia.org/wiki/Error_code)? Is the use of e...

vba error handling in loop

vba error handling in loop New to vba, trying an 'on error goto' but, I keep getting errors 'index out of range'. I just want to make a combo box that is populated by the names of worksheets which con...

6 Nov at 19:16

How to check the exit status using an 'if' statement

How to check the exit status using an 'if' statement What would be the best way to check the in an `if` statement in order to echo a specific output? I'm thinking of it being: The issue I am also havi...

Pipe output and capture exit status in Bash

Pipe output and capture exit status in Bash I want to execute a long running command in Bash, and both capture its exit status, and [tee](http://en.wikipedia.org/wiki/Tee_(command)) its output. So I d...

27 Aug at 04:9

Catching errors in Global.asax

Catching errors in Global.asax I have the following in my `Global.asax` which is meant for handling errors: ``` void Application_Error(object sender, EventArgs e) { Exception exception = Server.GetL...

16 Aug at 18:51

How to customize HTTP-500 error page for ServiceStack?

How to customize HTTP-500 error page for ServiceStack? I want to customize the error page shown if my ServiceStack app hits an unhandeled Exception and returns a HTTP-500. I'm using ServiceStack.Razor...

C# Nested Try Catch statements or methods?

C# Nested Try Catch statements or methods? Simple best practice question. Should you nest try catch statements or just use methods. For instance, if you have a method that opens a file does work and c...

19 Mar at 19:37

What is the best alternative "On Error Resume Next" for C#?

What is the best alternative "On Error Resume Next" for C#? If I put empty catch blocks for my C# code, is it going to be an equivalent for VB.NET's "On Error Resume Next" statement. The reason I am a...

25 Oct at 16:11

How to throw exception without resetting stack trace?

How to throw exception without resetting stack trace? This is a follow-up question to [Is there a difference between “throw” and “throw ex”](https://stackoverflow.com/questions/730250/is-there-a-diffe...

How to do try catch and finally statements in TypeScript?

How to do try catch and finally statements in TypeScript? I have error in my project, and I need to handle this by using , and . I can use this in JavaScript but not in Typescript. When I put as argum...

22 Sep at 12:40

In C# how to collect stack trace of program crash

In C# how to collect stack trace of program crash I am new to C#. I am writing a small desktop form based application and I need to have this feature in the app. If the application crashes at any time...

18 Apr at 05:32

How to get rid of try catch?

How to get rid of try catch? I'm bored with surrounding code with try catch like this.. I would like something like I know I can accomplish this behaviour by creating a delegate with the exact signatu...

22 Jun at 23:32

How do I catch an Ajax query post error?

How do I catch an Ajax query post error? I would like to catch the error and show the appropriate message if the Ajax request fails. My code is like the following, but I could not manage to catch the ...

22 Jul at 11:36

How to log unhandled exception in .net core

How to log unhandled exception in .net core With ELMAH feature in web api 2.0 and Centralized logging and error handling , runtime calls logging module and decide if it can be handled then calls the h...

26 Jul at 18:11

Begin, Rescue and Ensure in Ruby?

Begin, Rescue and Ensure in Ruby? I've recently started programming in Ruby, and I am looking at exception handling. I was wondering if `ensure` was the Ruby equivalent of `finally` in C#? Should I ha...