Exception: Parse::Error::AccountLockoutError

Inherits:
AuthenticationError show all
Defined in:
lib/parse/model/classes/user.rb

Overview

Raised by Client when the SDK's client-side login rate-limit guard fires — i.e. the same username has failed API::Users::LOGIN_MAX_FAILURES or more times and the exponential back-off window has not yet elapsed.

The class is a subclass of AuthenticationError so that a single rescue Parse::Error::AuthenticationError handler covers both wrong-credential failures and lockout situations. Callers that need to distinguish the lockout case just rescue this narrower subclass first. Because the previous implementation raised a plain +RuntimeError+, there is no prior +AuthenticationError+ rescue contract to preserve — this is a new typed entry in the login-failure taxonomy.

Note that +Parse::Error < StandardError+, so a bare +rescue+ or +rescue StandardError+ still catches this error.

Examples:

begin
  Parse::User.login!(username, password)
rescue Parse::Error::AccountLockoutError => e
  # Too many failed attempts — tell the user how long to wait
  retry_in = e.message[/\d+/]
  render_lockout_page(retry_in: retry_in)
rescue Parse::Error::AuthenticationError
  # Wrong credentials (or other login failure — also catches lockout
  # if no narrower rescue precedes it)
end

Instance Attribute Summary

Attributes inherited from Parse::Error

#code

Method Summary

Methods inherited from Parse::Error

#initialize

Constructor Details

This class inherits a constructor from Parse::Error