From 836176d9182b55e33a33368de0d4ac20ff330cba Mon Sep 17 00:00:00 2001 From: "kacaii.dev" Date: Sat, 11 Jul 2026 11:24:50 -0300 Subject: [PATCH] possum/did, possum/handle: rename InvalidFormat to InvalidSyntax --- CHANGELOG.md | 2 ++ src/possum/did.gleam | 4 ++-- src/possum/handle.gleam | 4 ++-- test/possum_test/did_test.gleam | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2600514..e9183f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,3 +16,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - All functions now use `prepend_header` instead of `set_header`. - Renamed `did.DidError` to `did.ParseError` +- Rename `did.InvalidFormat` to `did.InvalidSyntax` +- Rename `handle.InvalidFormat` to `handle.InvalidSyntax` diff --git a/src/possum/did.gleam b/src/possum/did.gleam index 41e999a..548175b 100644 --- a/src/possum/did.gleam +++ b/src/possum/did.gleam @@ -20,7 +20,7 @@ pub type ParseError { /// Regex failed to compile InvalidRegexPattern(pattern: String) /// String does not have a valid DID format - InvalidFormat(value: String) + InvalidSyntax(value: String) /// Method can only be "plc" or "web" InvalidDidMethod(value: String) } @@ -135,7 +135,7 @@ pub fn parse(content: String) -> Result(Did, ParseError) { use value <- result.try(case regexp.check(with:, content:) { True -> Ok(content) - False -> Error(InvalidFormat(content)) + False -> Error(InvalidSyntax(content)) }) case string.trim(value) { diff --git a/src/possum/handle.gleam b/src/possum/handle.gleam index 51dea9b..aed2a60 100644 --- a/src/possum/handle.gleam +++ b/src/possum/handle.gleam @@ -15,7 +15,7 @@ pub type ParseError { /// Regex failed to compile InvalidRegexPattern(pattern: String) /// String does not have a valid handle format - InvalidFormat(value: String) + InvalidSyntax(value: String) /// "Reserved" top-level domains should not fail syntax validation, /// but they must immediately fail any attempt at registration. /// @@ -53,7 +53,7 @@ pub fn parse(content: String) -> Result(Handle, ParseError) { use value <- result.try(case regexp.check(with:, content:) { True -> Ok(content) - False -> Error(InvalidFormat(content)) + False -> Error(InvalidSyntax(content)) }) use value <- result.map(check_invalid_domains(value)) diff --git a/test/possum_test/did_test.gleam b/test/possum_test/did_test.gleam index 41ec437..efd099f 100644 --- a/test/possum_test/did_test.gleam +++ b/test/possum_test/did_test.gleam @@ -34,7 +34,7 @@ pub fn parse_test() -> Nil { ) // invalid identifier syntax - let assert Error(did.InvalidFormat(_)) = + let assert Error(did.InvalidSyntax(_)) = list.try_fold( [ "did:METHOD:val", -- 2.51.2