Share via

Result Code in Azure Function

Rishabh Jain 1 Reputation point
2021-05-03T20:30:52.22+00:00

How to set result code in node js azure function (timer trigger) if any failure occurs ? Ex- If any error occur due to bad input, than I want to throw it as 400. Currently it's only logging with Exception and Stack. I want additional field status code (result code)

Thanks!!!

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,661 Reputation points Microsoft Employee Moderator
    2021-05-05T09:21:09.573+00:00

    @Rishabh Jain Only the HTTP Trigger has a request/response style paradigm. For other types of triggers, you can have output bindings to record the error like in a queue if you need to process them later.

    In most cases, throwing an exception and logging should do the trick for debugging.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.