This repository has been archived by the owner on Mar 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Create Exception module for error value #25
Labels
awaiting-review
An issue or pull request that needs to be reviewed
enhancement
New feature or request
T1h
Time Estimate 1 Hour
Comments
SimonLab
added
the
in-progress
An issue or pull request that is being worked on by the assigned person
label
May 24, 2022
SimonLab
added
awaiting-review
An issue or pull request that needs to be reviewed
and removed
help wanted
Extra attention is needed
in-progress
An issue or pull request that is being worked on by the assigned person
labels
May 24, 2022
@SimonLab I merged your PR #26 1) test commit/2 creates a commit in the repo (GiteaTest)
test/gitea_test.exs:169
** (MatchError) no match of right hand side value: {:error, %Git.Error{args: ["."], code: 1, command: "add", message: "The following paths are ignored by one of your .gitignore files:\ntmp\nhint: Use -f if you really want to add them.\nhint: Turn this message off by running\nhint: \"git config advice.addIgnoredFile false\"\n"}}
code: Gitea.commit(org_name, repo_name, %{
stacktrace:
(gitea 1.0.5) lib/gitea.ex:227: Gitea.commit/3
test/gitea_test.exs:182: (test)
2) test Gitea.push/2 pushes the commit to the remote repo (GiteaTest)
test/gitea_test.exs:195
** (MatchError) no match of right hand side value: {:error, %Git.Error{args: ["."], code: 1, command: "add", message: "The following paths are ignored by one of your .gitignore files:\ntmp\nhint: Use -f if you really want to add them.\nhint: Turn this message off by running\nhint: \"git config advice.addIgnoredFile false\"\n"}}
code: Gitea.commit(org_name, repo_name, %{
stacktrace:
(gitea 1.0.5) lib/gitea.ex:227: Gitea.commit/3
test/gitea_test.exs:209: (test) I did a fresh |
Meanwhile package published to https://hex.pm/packages/gitea/1.0.5 📦 🚀 (to not delay your work) |
Tested again on a fresh clone, I have the same errors. Lines 25 to 28 in 5dfdb2c
but
is using |
This was referenced May 25, 2022
Dedicated issue for creating submodule: #29 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
awaiting-review
An issue or pull request that needs to be reviewed
enhancement
New feature or request
T1h
Time Estimate 1 Hour
Go over the functions' return values and make sure they are consistent by returning either
{:ok, value}
or{:error, exception}
This will make it easier for applications using the library to pattern match on these functions.
For the
exception
we can create our own exception module, see https://elixir-lang.org/getting-started/try-catch-and-rescue.html#errorsI like the way the comment on this article describe how to use "custom" exception as return value for errors, and how it work nicely with the
with
statement using the:reason
key from the exception module, https://michal.muskala.eu/post/error-handling-in-elixir-libraries/see also https://medium.com/@moxicon/elixir-best-practices-for-error-values-50dc015a06f5
The text was updated successfully, but these errors were encountered: