Coder Social home page Coder Social logo

Comments (7)

oliverpool avatar oliverpool commented on August 17, 2024 1

One thought: in the documentation, it should be written that the datastores are supposed to work with any client; a custom http status must be appropriately!

  • 1xx: Continuing process
  • 2xx: Processed successfully
  • 3xx: Redirection (no reason to be used, I think)
  • 4xx: Client error (no need for the client to retry "as-is")
  • 5xx: Server error (a later retry may succeed)

from tusd.

Acconut avatar Acconut commented on August 17, 2024 1

I added a corresponding interface to address this issue. However, I am not entirely sure whether to keep the name, HTTPError. Will think about this a bit more :)

from tusd.

Acconut avatar Acconut commented on August 17, 2024

I do agree that this is a good idea. I will think a bit about how we can implement this is a proper way.

from tusd.

oliverpool avatar oliverpool commented on August 17, 2024

Maybe this could provide inspiration: https://elithrar.github.io/article/http-handler-error-handling-revisited/

from tusd.

oliverpool avatar oliverpool commented on August 17, 2024

@Acconut : any update on this?

The final implementation of https://elithrar.github.io/article/http-handler-error-handling-revisited/ allows to be fully backward compatible! (thanks to the switch e := err.(type))

from tusd.

Acconut avatar Acconut commented on August 17, 2024

I apologize for me belated response. Backwards-compatibility is not an issue I am concerned about but binding the data store implementations tightly to the HTTP protocol. Right now, the data stores have no knowledge that they are accessed using the HTTP protocol and keeping it like that has some advantages to separate the HTTP server accepting requests and the data store which takes care of handling the uploads. I haven't fully decided whether that's a big enough reason to prevent your feature request to be implemented or not but I will give it a try the next few days and then we will see.

from tusd.

oliverpool avatar oliverpool commented on August 17, 2024

I get your point about not only thinking about the http protocol.

Currently the specs only tells about http:

"The protocol provides a mechanism for resumable file uploads via HTTP/1.1 (RFC 7230) and HTTP/2 (RFC 7540)." https://tus.io/protocols/resumable-upload.html#abstract

And I think that if another protocol is supported at some point, it will also need a way to get some status about the transmission. Since the http status codes are well documented, they can be used as a basis to be translated to match the other protocol status codes.

Moreover I see no drawback into providing a custom error interface (StatusError{403, err} for instance) to categorize the errors:

  • if you need the categorization at a later point in time, it's already available
  • if you don't need it, you can still consider them as regular error

from tusd.

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.