Closed GetContented closed 8 years ago
Maybe errors could be sent to the same channel as successful uploads and messages just contain some different data?
Really welcoming any efforts toward error handling! :)
I did consider that, but isn't that kind of a breaking change? Your current implementation puts the file back into the done channel, I think, so the contract you have is that "anything" received on that channel is indication that the upload was successful.
However, if breaking changes aren't too much of a concern, using the file itself as an indicator is probably less than ideal. I wonder if we could wrap the file in a map, and that way we could mark it with an identifier that we could respond with... the reason being that you have async uploads (concurrency of 3, I think), then they won't necessarily succeed in the order that you've put them up in. ({:file #
I'm not concerned about breaking changes as long as we're sub 1.0.
So if right now we're sending back the plain location of the file I think it would be a good idea to make that a bit more extendable, I.e. a map.
An identifier makes sense, probably that should be the key on S3 — see #7 and #16 for that.
Hm. Ok. So at the moment there's no way to specify the object key? That's a bit of a deal breaker for me. Would need to have that fixed ASAP. Can we merge bensu's PR in? I don't really understand what the key-fn does... personally I'd like to be able to specify the key myself... is this the file-name passed to the server side sign function?
I don't use the clojure / ring server. I'm unfortunately stuck on Rails for the next few months at least... so I've written my own backend sign function...
I think I understand the intent of the key-fn now... but I'd still like the option of passing in an object-key to the map as first preference over the key... is bensu's branch ready to be merged? Is there a reason you haven't merged it already, @martinklepsch ?
Update: no need to respond to this.
Ok, so here's my plan:
Do you want these all as one PR? It seems like it might be a lot of changes to review all at once.
@martinklepsch ok, I've finished this so I'll put up a PR. No response from you yet as to how you'd like to proceed, but, well, you can check it out and see what you think.
Ok @martinklepsch I've created https://github.com/martinklepsch/s3-beam/pull/21 which should hopefully supercede https://github.com/martinklepsch/s3-beam/pull/7 and https://github.com/martinklepsch/s3-beam/pull/16 if I've done it correctly.
Most importantly, it now handles error that happen at either the key-signing server, or the AWS server. Also of interest:
It could deal with some additional documentation and adjustment to the readme, which I'd be happy to write if you'd like.
I'm using this in production now, so I'm pretty confident it works ok. Still no tests, though! (gulp)
I'll leave this open until there's been some more movement on it.
Closed via #24
Hi @martinklepsch I'm about to implement something around errors (because I need it on s3-beam in my app). Are you happy with the idea of passing in a chan on the opts map, which, if present will have a map of error-message and error-code put on it? (something like {:error-message "" :error-code 0} I'm imagining at this stage)?
I'll go ahead with that anyway, let me know if you've got another preference.