Errors unreadable when Exceptions thrown
See original GitHub issuePlease provide a succinct description of the issue.
Repro steps
run.fsx:
open System
open Microsoft.Azure.WebJobs.Host
let Run (input: string, tw: TraceWriter) =
tw.Info "function starting"
// something in my code throws an exception
failwithf "function failed for this reason"
tw.Info "function finished"
Expected behavior
It prints "“function failed for this reason” somewhere.
Actual behavior
Error displayed in Invocation Details:
...obs.Script.Description.FunctionInvokerBase.<Invoke>d__29.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`1.<InvokeAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<InvokeAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithWatchersAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__13.MoveNext()
--- End of inner exception stack trace ---
Known workarounds
Catch it and log it yourself somewhere, then re-throw.
Related information
I’m was trying to track down an error. https://social.msdn.microsoft.com/Forums/azure/en-US/f01749c4-e7c9-4e9b-9a05-68d04a714c0e/30-minute-timeout-on-normal-always-on-plan?forum=AzureFunctions
cc @dsyme
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:11 (5 by maintainers)
Top Results From Across the Web
error handling - Result object vs throwing exceptions
A method should throw an exception when it's unable to fulfill its contract, which is based on how you name the method. The...
Read more >How to Throw Exceptions in Java
Throwing an exception is as simple as using the "throw" statement. You then specify the Exception object you wish to throw. Every Exception...
Read more >How to fix "'throw' of exception caught locally"?
If all you have to do is "sendErrorCode()" and then return, this is fine. However, if you have to do several actions in...
Read more >Clean Code and the Art of Exception Handling
An unhandled exception may cause unexpected behavior, and results can be spectacular. Over time, these errors have contributed to the impression that exceptions...
Read more >java - Which is better - Throwing an Exception or Checking ...
The usual consensus is to use exceptions only for exceptional cases and not as a control flow construct. Trying to use a username...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A C# run.csx also has similar poor behavior.
I’ve found the problem (it’s in my code). I’m throwing a plain object (not an Error instance)