Use error type instead of error message to check v1 connection error

This commit is contained in:
Alasdair Smith 2018-06-19 16:25:56 +01:00
parent 82a8e37071
commit 8de9e9fae4

View file

@ -180,7 +180,7 @@ module.exports = ProjectController =
ProjectGetter.findAllUsersProjects user_id, 'name lastUpdated publicAccesLevel archived owner_ref tokens', cb
v1Projects: (cb) ->
Modules.hooks.fire "findAllV1Projects", user_id, (error, projects = []) ->
if error? and error.message == 'No V1 connection'
if error? and error instanceof V1ConnectionError
return cb(null, projects: [], tags: [], noConnection: true)
return cb(error, projects[0]) # hooks.fire returns an array of results, only need first
hasSubscription: (cb)->