Skip to content

Fix the types of NSError.userInfo and localizedRecoveryOptions - #90

Merged
maleadt merged 2 commits into
mainfrom
tb/userinfo
Oct 20, 2026
Merged

maleadt merged 2 commits into
mainfrom
tb/userinfo

Conversation

@maleadt

@maleadt maleadt commented Oct 20, 2026

Copy link
Copy Markdown
Member

Two NSError properties had the wrong types:

  • userInfo converted to Dict{NSString,Object}, but Object is abstract and can't wrap a pointer. Reading the user info of any error that has some threw MethodError: no method matching Object(::id{Object}). The values are now NSObjects.
  • localizedRecoveryOptions is an NSArray of strings, not an NSString. showerror then sent UTF8String to the array, which aborts the process (-[__NSArrayI UTF8String]: unrecognized selector) whenever an error with recovery options is displayed. It's now a Vector{NSString}.

Found while looking at the errors Metal returns when pipeline creation fails (JuliaGPU/Metal.jl#1074). Tests for both properties are in the NSError testset.

The property converted to `Dict{NSString,Object}`, but `Object` is abstract
and can't wrap a pointer, so reading the user info of any error that has
some threw a `MethodError`. Convert the values to `NSObject` instead.
It is an array of strings, not a string. Treating it as an `NSString` made
`showerror` send `UTF8String` to an `NSArray`, which aborts the process with
an uncaught Objective-C exception for any error that has recovery options.
@maleadt
maleadt merged commit 16e3c46 into main Oct 20, 2026
12 checks passed
@maleadt
maleadt deleted the tb/userinfo branch October 20, 2026 06:55
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.

1 participant