Sha256: b650b303d271bb58897b71ae56ba926a778eda9f710e3ce286cf397c22bc4e69
Contents?: true
Size: 921 Bytes
Versions: 12
Compression:
Stored size: 921 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
12 entries across 12 versions & 1 rubygems