Skip to content

Commit

Permalink
improve code for CustomNSError example (#8660)
Browse files Browse the repository at this point in the history
Defining the function in the property would create a new function every time the `errorUserInfo` property is accessed.
  • Loading branch information
koenpunt committed Dec 14, 2023
1 parent 5541ff2 commit 56f2124
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/platform-includes/capture-error/apple.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ enum MyCustomError: Error {

extension MyCustomError: CustomNSError {
var errorUserInfo: [String : Any] {
func getDebugDescription() -> String {
switch self {
case .indexOutOfBounds:
return "indexOutOfBounds"
case .enumeratingWhileMutating:
return "enumeratingWhileMutating"
}
}

return [NSDebugDescriptionErrorKey: getDebugDescription()]
}

private func getDebugDescription() -> String {
switch self {
case .indexOutOfBounds:
return "indexOutOfBounds"
case .enumeratingWhileMutating:
return "enumeratingWhileMutating"
}
}
}
```

Expand Down

1 comment on commit 56f2124

@vercel
Copy link

@vercel vercel bot commented on 56f2124 Dec 14, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

sentry-docs – ./

docs.sentry.io
sentry-docs-git-master.sentry.dev
sentry-docs.sentry.dev

Please sign in to comment.