Skip to content

shared: Remove numeric value, repr(C) and UnknownError from EDHOCError#236

Merged
geonnave merged 6 commits intolake-rs:mainfrom
chrysn-pull-requests:edhocerror-no-numerics
Mar 8, 2024
Merged

shared: Remove numeric value, repr(C) and UnknownError from EDHOCError#236
geonnave merged 6 commits intolake-rs:mainfrom
chrysn-pull-requests:edhocerror-no-numerics

Conversation

@chrysn
Copy link
Copy Markdown
Member

@chrysn chrysn commented Mar 6, 2024

The numbers associated to EDHOCError are confusing because they do not match the EDHOC ERR_INFO numeric values. Let's try whether we really need them.

(Frankly, at this stage this is looking for whether CI takes it).

@chrysn
Copy link
Copy Markdown
Member Author

chrysn commented Mar 6, 2024

Hm, first pass worked. From chats it seems repr(C) is not essential there anyway, and the UnknownError is not used (and rather bad practice in error types compared to non_exhaustive); adding two more simple (semver breaking, but so is removal of the numeric values) changes.

@chrysn chrysn marked this pull request as ready for review March 6, 2024 13:41
@chrysn chrysn changed the title shared: Remove value from EDHOCError shared: Remove numeric value, repr(C) and UnknownError Mar 6, 2024
@chrysn chrysn changed the title shared: Remove numeric value, repr(C) and UnknownError shared: Remove numeric value, repr(C) and UnknownError from EDHOCError Mar 6, 2024
@geonnave
Copy link
Copy Markdown
Collaborator

geonnave commented Mar 6, 2024

I said it on chat but I was wrong: let's keep repr(C). Right now I don't use it but it is good to make EDHOCError available for implementations that need to check the error.

The numeric value can stay omitted, though.

@chrysn
Copy link
Copy Markdown
Member Author

chrysn commented Mar 6, 2024

Shouldn't the #[repr(C)] be added if and when the type is exposed to C, given the C side can't make use of the data without copying constants? And I think that the preferred abstraction would be to have an edhoc_error_get_err_id() function depending on how things go with aligning with the EDHOC spec. (I'll update to repr(C) if you persist, just wanted to mention the alternative before.)

@chrysn chrysn force-pushed the edhocerror-no-numerics branch from 5f47a66 to 855f44a Compare March 7, 2024 11:01
@chrysn chrysn force-pushed the edhocerror-no-numerics branch from 855f44a to 65bbcf0 Compare March 7, 2024 11:09
@chrysn
Copy link
Copy Markdown
Member Author

chrysn commented Mar 7, 2024

Added an accessor as per chat. This is not yet mapped to C, but can be on demand (but so far, the repr(C) on the error type was not used either).

@chrysn chrysn force-pushed the edhocerror-no-numerics branch from 01ffca6 to c952349 Compare March 7, 2024 15:39
@geonnave geonnave merged commit b977f86 into lake-rs:main Mar 8, 2024
@chrysn chrysn deleted the edhocerror-no-numerics branch March 8, 2024 10:18
@geonnave geonnave added the type:enhancement New feature or request label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants