mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 05:37:51 +00:00
Implement InvalidCredentials error
This commit is contained in:
parent
e21c1588c9
commit
551202dd4e
@ -3,6 +3,7 @@ _ = require('lodash')
|
||||
|
||||
token = require('../token/token')
|
||||
server = require('../server/server')
|
||||
errors = require('../errors/errors')
|
||||
config = require('../config')
|
||||
|
||||
exports.authenticate = (credentials, callback) ->
|
||||
@ -32,7 +33,7 @@ exports.parseCredentials = (credentials, callback) ->
|
||||
result = credentials.split(':')
|
||||
|
||||
if result.length isnt 2
|
||||
error = new Error('Invalid credentials. The expected input is username:password.')
|
||||
error = new errors.InvalidCredentials()
|
||||
return callback?(error)
|
||||
|
||||
callback? null,
|
||||
|
@ -7,6 +7,11 @@ exports.NotFound = class NotFound extends TypedError
|
||||
@message = "Couldn't find #{name}"
|
||||
@code = 1
|
||||
|
||||
exports.InvalidCredentials = class InvalidCredentials extends TypedError
|
||||
constructor: ->
|
||||
@message = 'Invalid credentials'
|
||||
@code = 1
|
||||
|
||||
exports.NotAny = class NotAny extends TypedError
|
||||
constructor: (name) ->
|
||||
@message = "You don't have any #{name}"
|
||||
|
Loading…
Reference in New Issue
Block a user