<!--
{
  "availability" : [
    "macOS: 10.1.0 - 10.11.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSAccessibility-swift.struct/raiseBadArgumentException(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:@F@NSAccessibilityRaiseBadArgumentException"
  },
  "title" : "raiseBadArgumentException(_:_:_:)"
}
-->

# raiseBadArgumentException(_:_:_:)

Raises an error if the parameter is the wrong type or has an illegal value

```
static func raiseBadArgumentException(_ element: Any!, _ attribute: NSAccessibility.Attribute!, _ value: Any!)
```

## Discussion

Raises an error if a parameter is the wrong type or has an illegal value. This function can also be used to raise an error if an attempt is made to set an attribute’s value with the wrong type or an illegal value.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)