Skip to content

Make ATTError an extensible struct#201

Open
dpogueproton wants to merge 1 commit intoPureSwift:masterfrom
ProtonIntel:atterror-struct
Open

Make ATTError an extensible struct#201
dpogueproton wants to merge 1 commit intoPureSwift:masterfrom
ProtonIntel:atterror-struct

Conversation

@dpogueproton
Copy link
Copy Markdown

Issue

Fixes #200.

What does this PR Do?

Converts ATTError from an enum to a struct to allow for extending with additional application-specific error codes.

ATTError(rawValue: 0) returns nil because 0x00 is the success code.

All the pre-defined errors are set up so they return a non-Optional ATTError, and this should be API compatible with all existing code.

Where should the reviewer start?

ATTError.swift

public struct ATTError: RawRepresentable, Equatable, Hashable, Error {
public typealias RawValue = UInt8

enum Code: UInt8 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the Code enum and change that to static var cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ATTError cannot support additional common error codes

2 participants