You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This behavior seems likely to cause silent errors, as opposed to throwing or returning an optional string.
As an example, I was trying to get the string representation of a BCrypt salt back out of the digest. My first attempt (totally wrong, I should have used Serializer) was this:
The text was updated successfully, but these errors were encountered:
mjmsmith
changed the title
Sequence.makeString() in ByteSequence+Conversions.swift returns empty string on failure.
Sequence.makeString() returns empty string on failure.
May 22, 2017
Because of how integral this function is to every package in the framework, I don't think it will be possible to change. A lot of code relies on this not throwing and not returning an optional.
I'd recommend asserting that the string != "" or creating your own extension on Sequence that throws.
I've nonetheless added this to the Vapor 3 wishlist. Thanks!
No problem, I should have just used an optional String initializer in the first place. Might be worth changing the method name at some point to discourage use. (I suspect I only used it because I tripped across it in the BCrypt source.)
In ByteSequence+Conversions.swift.
This behavior seems likely to cause silent errors, as opposed to throwing or returning an optional string.
As an example, I was trying to get the string representation of a BCrypt salt back out of the digest. My first attempt (totally wrong, I should have used Serializer) was this:
It returned "" rather than indicating failure.
The text was updated successfully, but these errors were encountered: