SAML-Toolkits / ruby-saml

SAML SSO for Ruby
MIT License
924 stars 566 forks source link

Raise meaningful error when IDP descriptor can’t be found #716

Open eriklovmo opened 4 months ago

eriklovmo commented 4 months ago

Here, raise a more meaningful error when the identity provider metadata does not contain an IDP descriptor, or no IDP descriptor matching the value of the optional entity_id option.

Raising an ArgumentError implies that some invariants of the method failed, when in fact this error occurs when arguments are superficially valid but parsing fails due to "business logic". Additionally, by using namespaced, specific errors we make the API easier and safer for user code.

johnnyshields commented 3 months ago

Rather than doing this as a one-off, it would be better to look at all errors RubySaml generates and make them into proper classes.