Skip to content

Commit

Permalink
refactor!: rename InvalidFieldAttribute to InvalidFieldAttributeError
Browse files Browse the repository at this point in the history
  • Loading branch information
ahamez committed Feb 25, 2025
1 parent f04657a commit e3e03b6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- BREAKING CHANGE: Configuration of features to generate via the CLI mix task is done with the `--generate` argument.
- BREAKING CHANGE: encoding functions now return the size alongside iodata. Before that, one had to use :binary.list_to_bin/1 to flatten the iodata to then use byte_size, defeating the purpose of having an iodata.
- BREAKEING CHANGE: `Protox.decode!` and `Protox.decode` no longer raise or return an error if a message with required fields don't have all said fields set. The rationale being that we should let the user decide if it's a problem or not.
- BREAKING CHANGE: `Protox.decode!` and `Protox.decode` no longer raise or return an error if a message with required fields don't have all said fields set. The rationale being that we should let the user decide if it's a problem or not.
- BREAKING CHANGE: Rename `InvalidFieldAttribute` to `InvalidFieldAttributeError` for consistency.

### Removed
- Drop support for Elixir < 1.15.
Expand Down
2 changes: 1 addition & 1 deletion lib/protox/errors.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ defmodule Protox.IllegalTagError do
end
end

defmodule Protox.InvalidFieldAttribute do
defmodule Protox.InvalidFieldAttributeError do
@moduledoc """
This error is thrown when a field is constructed with an invalid atribute.
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/protox/field.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ defmodule Protox.Field do
if label in @labels do
label
else
raise Protox.InvalidFieldAttribute.new(:label, @labels, label)
raise Protox.InvalidFieldAttributeError.new(:label, @labels, label)
end
end
end
4 changes: 2 additions & 2 deletions test/protox/field_test.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Protox.FieldTest do
use ExUnit.Case

alias Protox.{Field, IllegalTagError, InvalidFieldAttribute, Scalar}
alias Protox.{Field, IllegalTagError, InvalidFieldAttributeError, Scalar}

describe "errors" do
test "can't construct with tag == 0" do
Expand All @@ -11,7 +11,7 @@ defmodule Protox.FieldTest do
end

test "can't construct with invalid label" do
assert_raise InvalidFieldAttribute, fn ->
assert_raise InvalidFieldAttributeError, fn ->
Field.new!(
tag: 1,
label: :invalid_label,
Expand Down

0 comments on commit e3e03b6

Please sign in to comment.