Meter icon indicating copy to clipboard operation
Meter copied to clipboard

Integration with swift-system SPM for errno types?

Open SwiftNativeDeveloper opened this issue 4 years ago • 3 comments

When I was checking out some new Apple SPM's I discovered Swift System and thought that there would be opportunity to use the official 'Errno.swift' in conjunction with the diagnostic payloads.

Specifically properties on the MXCrashDiagnostic like exceptionType, exceptionCode, signal, etc. have Errno mappings that are more meaningful than the MetricKit NSNumber that is provided.

Thoughts if this would compliment the goal of this library?

SwiftNativeDeveloper avatar Jan 07 '22 19:01 SwiftNativeDeveloper

I wasn’t aware of Swift System, thanks for pointing it out!

I’m afraid, though that none of the MXCrashDiagnostic properties are errno values. signal is a code from signal.h, exceptionType and exceptionCode are mach exception constants from mach/exc.h (doing this from memory, could be wrong on header name).

However, I do think it’s reasonable to incorporate some decoding of these values into Meter.

mattmassicotte avatar Jan 07 '22 19:01 mattmassicotte

Named enums or struct instances are much more swift-y than the NSNumber. It has been a while since I looked at signal header file so I probably mixed up some of the mapping in my head.

SwiftNativeDeveloper avatar Jan 07 '22 19:01 SwiftNativeDeveloper

Yeah agreed. My goal was to mirror the underlying API as much as possible, but I think it is a great idea to add an additional API that offers decoded values.

mattmassicotte avatar Jan 07 '22 23:01 mattmassicotte