Skip to content

Commit

Permalink
Update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrumm committed Nov 16, 2023
1 parent 587de5e commit d5e2191
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
44 changes: 36 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Changelog

## v0.5.0

This version changes the Briefly API, so read the notes below and upgrade with care.

- Change the return value of `Briefly.create/1` to be either `{:ok, path}` or
`{:error, Exception.t()}`. The following exceptions may be returned:

- `%Briefly.NoRootDirectoryError{}` - Briefly is unable to create a root temporary
directory. The exception contains the temp dirs attempted.

- `%Briefly.WriteError{}` - A temporary entry cannot be created. The exception
contains the POSIX error code the caused the failure.

For example, if you have this:

```elixir
case Briefly.create() do
{:ok, path} -> path
{:no_space, _} -> raise "no space"
{:too_many_attempts, _} -> raise "too many attempts"
{:no_tmp, _} -> raise "no tmp dirs"
end
```

...then change it to this:

```elixir
case Briefly.create() do
{:ok, path} -> path
{:error, %Briefly.WriteError{code: :enospc}} -> raise "no space"
{:error, %Briefly.WriteError{code: c}} when c in [:eexist, :eacces] -> raise "too many attempts"
{:error, %Briefly.NoRootDirectoryError{}} -> raise "no tmp dirs"
{:error, exception} when is_exception(exception) -> raise exception
end
```

- Add `Briefly.give_away/3` to transfer ownership of a tmp file.
- Deprecate the `:monitor_pid` option.

Expand All @@ -16,14 +52,6 @@ If you were previously using `:monitor_pid` like this:
:ok = Briefly.give_away(path, pid)
```

### Exceptions

The following exceptions may now be returned from `Briefly.create/1`:

- `%Briefly.NoRootDirectoryError{}` - returned when a root temporary directory could not be accessed.

- `%Briefly.WriteError{}` - returned when an entry cannot be created.

## v0.4.1 (2023-01-11)

- Fix an issue with custom tmp dirs without a trailing slash ([#24](https://github.com/CargoSense/briefly/pull/24)) @srgpqt
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Briefly.Mixfile do
defp package do
[
description: "Simple, robust temporary file support",
files: ["lib", "config", "mix.exs", "README*", "LICENSE"],
files: ["lib", "config", "mix.exs", "README*", "LICENSE", "CHANGELOG.md"],
contributors: ["Bruce Williams", "Michael A. Crumm Jr."],
licenses: ["Apache-2.0"],
links: %{"GitHub" => @source_url}
Expand All @@ -49,7 +49,7 @@ defmodule Briefly.Mixfile do
language: "en",
formatters: ["html"],
main: "usage",
extras: ["guides/usage.livemd"]
extras: ["guides/usage.livemd", "CHANGELOG.md"]
]
end

Expand Down

0 comments on commit d5e2191

Please sign in to comment.