Coder Social home page Coder Social logo

Comments (13)

dmitrizagidulin avatar dmitrizagidulin commented on June 12, 2024

@gannan08 are you sure? The thing about register() is that it requires an already generated DID Doc to be passed in. What would be the point of returning it? (It's immutable.)
The reason it's returning an axios response is so that the calling code can judge success/failure.

from did-io.

mattcollier avatar mattcollier commented on June 12, 2024

@dmitrizagidulin there were some test written against this API that were working before largely based on this documentation: https://github.com/digitalbazaar/did-io#generating-and-registering-a-veres-one-did-document

Perhaps returning the did document is optional, but throwing an error on failure is a requirement. Discerning a failure condition based on axios response is did-io's job IMO.

from did-io.

dmitrizagidulin avatar dmitrizagidulin commented on June 12, 2024

Discerning a failure condition based on axios response is did-io's job IMO.

Sure, agreed. I was thinking more about app-level logic failures (like, the ledger saying "your accelerator proof didn't check out"), which are less the domain of axios? Or are you thinking like, those kind of errors should return as status 400 anyways, in which case axios will throw em? In which case, yeah.

there were some test written against this API that were working before

Wait, did the tests break now, or..?

from did-io.

mattcollier avatar mattcollier commented on June 12, 2024

The test in question was patched earlier today, it passes like this: veres-one/veres-one@3a69c04

We would like it to be restored to it's former self.

from did-io.

mattcollier avatar mattcollier commented on June 12, 2024

We're talking about the register API. :)

from did-io.

dmitrizagidulin avatar dmitrizagidulin commented on June 12, 2024

We would like it to be restored to it's former self.

Ok. So you'd like register() to return the did doc, makes sense.

Do you foresee any need for the register call results from the ledger?

We're talking about the register API.

Riiight, ok, I was meta-confused :)

from did-io.

mattcollier avatar mattcollier commented on June 12, 2024

If the concern is that we might need to float axios errors up the stack, maybe something along these lines is appropriate? https://github.com/digitalbazaar/http-signature-header/blob/master/lib/HttpSignatureError.js

So, I would think that if the HTTP API returns some json schema validation error (for instance), the caller of did-io would need to have access to that information to address the cause of the failure.

from did-io.

dmitrizagidulin avatar dmitrizagidulin commented on June 12, 2024

@mattcollier So the errors I could see - they'll propagate like exceptions usually do.
What about successes? Do you foresee any need for the success results?

from did-io.

mattcollier avatar mattcollier commented on June 12, 2024

Are there different flavors of success? Are we speaking about the register API specifically or did-io APIs generally?

from did-io.

dmitrizagidulin avatar dmitrizagidulin commented on June 12, 2024

I don't know, re different flavors of success. :) (And yeah, talking specifically about the register API).

Tell you what, I'm cool with just having it return a did doc, and discarding the register results, for now. If we need em later, we can refactor.

from did-io.

gannan08 avatar gannan08 commented on June 12, 2024

To understand this correctly if the server returns a 204 (Success) we will be returning a did doc, else throw an error?

from did-io.

dmitrizagidulin avatar dmitrizagidulin commented on June 12, 2024

To understand this correctly if the server returns a 204 (Success) we will be returning a did doc, else throw an error?

Right!

from did-io.

dmitrizagidulin avatar dmitrizagidulin commented on June 12, 2024

Merged, closing.

from did-io.

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.