What should be the error response for adaptive card actions?

Leander Scherwinsky 20 Zuverlässigkeitspunkte
2024-08-28T14:21:39.6066667+00:00

https://github.com/MicrosoftDocs/AdaptiveCards/blob/a5d7403042d00acb58c0260d7a77156b89b5cc05/AdaptiveCards/authoring-cards/universal-action-model.md?plain=1#L217-L225

The docs for the error type are just a "todo".

Could you give me an example what i should return for the following types:

  • application/vnd.microsoft.error (400)
  • application/vnd.microsoft.activity.loginRequest (401)
  • application/vnd.microsoft.error.preconditionFailed (412)
  • application/vnd.microsoft.error (500)
Microsoft Teams
Microsoft Teams
Ein anpassbarer, chatbasierter Arbeitsbereich von Microsoft.
42 Fragen
0 Kommentare Keine Kommentare
{count} Stimmen

Akzeptierte Antwort
  1. Stanislava Dimitrova (Convergys International) 625 Zuverlässigkeitspunkte Microsoft-Anbieter
    2024-08-29T09:01:10.5233333+00:00

    Hello Leander,

    400 Bad Request: Indicates malformed request data.

    401 Unauthorized: Indicates authentication is required or has failed.

    412 Precondition Failed: Indicates that the request failed due to unmet preconditions.

    500 Internal Server Error: Indicates a generic server-side issue.

    You can include a type field to specify the error type, a code field for the HTTP status code, and a message field with a human-readable explanation of the error. Adapt the "message" field to provide clear guidance based on the specific error conditions in your application.

    Best Regards,


1 zusätzliche Antwort

Sortieren nach: Am hilfreichsten
  1. Leander Scherwinsky 20 Zuverlässigkeitspunkte
    2024-08-29T10:23:24.5866667+00:00

    Hi, thanks for that info, I ended up discovering theres a factory for these types:

    
    using Microsoft.TeamsFx.Conversation;
    
    var invokeRes = InvokeResponseFactory.ErrorResponse(InvokeResponseErrorCode.BadRequest, "Invalid Data");
    
    return (AdaptiveCardInvokeResponse)res.Body;
    
    
    0 Kommentare Keine Kommentare

Ihre Antwort

Fragesteller*innen können Antworten als akzeptierte Antworten markiert werden, wodurch Benutzer*innen wissen, dass diese Antwort das Problem gelöst hat.