Belt.await Typespec Wrong

Issue #3 closed
Former user created an issue

The Belt.await/2 typespec is wrong. The Typespec says that an {:ok, term} or errors are returned. Currently it returns only a term without the ok tuple though.

Comments (8)

  1. pentacent repo owner

    Thank you for reporting this problem. This should not be happening but I was unable to reproduce it on my end. Could you post a code example?

  2. Former user Account Deleted

    @pentacent I should've been more specific. It only happens in the case of delete I think.

  3. pentacent repo owner

    @maennchen_jm Thank you for specifying this.

    Belt.delete/3 returns :ok | {:error, String.t}, so it wouldn’t really make sense for Belt.await/2 to return anything but :ok when the operation was successful.

    Belt.delete_all/2 and Belt.delete_scope/3 are missing a typespec at the moment but they both return :ok upon success as well.

    Maybe in the next major release we can change Belt.delete/3 and Belt.delete_all/2 and Belt.delete_scope/3 to return {:ok, n} where n is the number of deleted files.

    For now I will provide a fix to extend the typespec of await/2 and add a typespec to delete_all/2 and delete_scope/3.

  4. Log in to comment