Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Cloud Functions
  • Comparison with other Yandex Cloud services
    • Overview
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ
  1. Developing in .NET Core
  2. Handling errors

.NET Core function error handling

Written by
Yandex Cloud
Updated at May 12, 2025

If a handler reports a .NET Core function runtime or loading error, the runtime environment automatically intercepts the error and responds by returning a JSON document with the error type info. For more information about the JSON document format, see Calling a function.

The error info is also written to the execution log. You can view the log via the Yandex Cloud CLI or the management console.

Examples of error handlingExamples of error handling

Case 1: User code goes outside the array boundaries, resulting in IndexOutOfRangeException. The runtime environment intercepts the exception and generates a JSON document containing the error message (errorMessage field), error type (errorType field), and stack trace (stackTrace field).

Function code:

public class Handler {
  public int FunctionHandler(byte[] input) {
    readonly var array = new int[]{1, 2, 3, 4, 5};
    // at this point, the function throws an IndexOutOfRangeException
    return array[15];
  }
}

JSON document returned:

{
  "errorMessage": "Index was outside the bounds of the array",
  "errorType": "System.IndexOutOfRangeException",
  "stackTrace": [
    ...
  ]
}

Case 2: User code indicates an error by throwing an exception from the function.

Function code:

public class Handler {
  public int FunctionHandler(byte[] input) {
    throw new SystemException("Some error message");
  }
}

JSON document returned:

{
  "errorMessage": "Some error message",
  "errorType": "System.SystemException",
  "stackTrace": [
    ...
  ]
}

Was the article helpful?

Previous
Logging
Next
Using the SDK
© 2025 Direct Cursus Technology L.L.C.