Sha256: ea74f6d1f205bafe0e2c7b8c4a7d6a7ebc0500f581c9e6e1cd0e76a1f89103ee
Contents?: true
Size: 924 Bytes
Versions: 1
Compression:
Stored size: 924 Bytes
Contents
class window.Errors constructor: (response)-> if response.status == 401 if response.getResponseHeader('X-Credentials') == 'Missing Credentials' @missingCredentials = true else if response.getResponseHeader('X-Credentials') == 'Invalid Credentials' @invalidCredentials = true else if response.getResponseHeader('X-Credentials') == 'Oauth' @oauthLocation = response.getResponseHeader('Location') else message = response.responseText ? "You are not authorized" @errors = {base: [message]} else @errors = JSON.parse(response.responseText) renderToAlert: -> sentences = [] for attribute, messages of @errors if attribute == "base" sentences.push messages[0] else sentences.push "#{attribute} #{messages[0]}" alertify.error sentences.join(".\n") Errors.fromResponse = (response)-> new Errors(response)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
houston-core-0.5.0.beta1 | app/assets/javascripts/core/errors.coffee |