Improve the check for when the device has been provisioned but the supervisor doesn't have knowledge of it in its local state

This change improves the check for the DuplicateUuidError that can happen if a device has been provisioned but the API's response hasn't been persisted - the error message
returned from the API has been known to have a few variations (usually an extra dot at the end), so we now use _.startsWith instead of checking for equal strings to make the
supervisor still work under these variations.

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
Pablo Carranza Velez 2017-10-23 17:28:36 -07:00
parent d98897cdcf
commit 3f198fc6aa

View File

@ -16,7 +16,7 @@ semverRegex = require('semver-regex')
userConfig = {}
DuplicateUuidError = message: '"uuid" must be unique.'
DuplicateUuidError = (err) -> _.startsWith(err.message, '"uuid" must be unique')
exports.ExchangeKeyError = class ExchangeKeyError extends TypedError
bootstrapper = {}