GithubHelp home page GithubHelp logo

Comments (5)

kentcb avatar kentcb commented on June 15, 2024 2

Thanks @mkolt - this is great.

Per my original request though, I don't think this issue should be closed until this information has been added to the docs. I just tried googling "Cosmos DB SubStatusCode errorCode" and can't find anything in the docs about this. Actually, one of the first results to come up is this user voice.

from azure-cosmos-dotnet-v3.

kirankumarkolli avatar kirankumarkolli commented on June 15, 2024

@kentcb can you please sent a mail to askcosmosdb[AT]microsoft.com? I will compile and put the summary on this thread.

from azure-cosmos-dotnet-v3.

mkolt avatar mkolt commented on June 15, 2024

From inside sproc you can throw new Error(errorCode, "Error message"), where errorCode is a number (short int) like 1234. On client side you can get this code from DocumentClientException as SubStatusCode which can be obtained from DocumentClientException.ResponseHeaders (e.g. see how to get it).

from azure-cosmos-dotnet-v3.

andersborum avatar andersborum commented on June 15, 2024

What's the status on this? I am unable to find any official information on the "x-ms-substatus" HTTP response header. I've been using Cosmos DB for some time now and am starting to write SPROCs using typescript (async/await for the win), and with that quickly came the requirement of relaying different error codes back to the caller.

from azure-cosmos-dotnet-v3.

AlejandroBlanco avatar AlejandroBlanco commented on June 15, 2024

I agree. This is poor or forced design. Error codes within errors throws from sprocs cause always a BadRequestException without any data except a cosmosError added by force to suck Exception and the internal sub error codes. I think the container client should parse the error codes, not the user

from azure-cosmos-dotnet-v3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.