Skip to content

Commit

Permalink
Merge pull request #338 from FlowFuse/better-error
Browse files Browse the repository at this point in the history
Better error logging when provisioning devices with token
  • Loading branch information
hardillb authored Jan 17, 2025
2 parents d30dd30 + 01eee5c commit 68eb773
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/AgentManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ class AgentManager {
}

// Get the local IP address / MAC / Hostname of the device for use in naming
const { host, ip, mac, forgeOk } = await this._getDeviceInfo(provisioningConfig.forgeURL, this.configuration?.token)
const { host, ip, mac, forgeOk, _error } = await this._getDeviceInfo(provisioningConfig.forgeURL, this.configuration?.token)
if (!forgeOk) {
throw new Error('Unable to connect to the Forge Platform')
throw new Error('Unable to connect to the Forge Platform', { cause: _error })
}
const type = 'Auto Provisioned' + (provisioningConfig.provisioningName ? ` [${provisioningConfig.provisioningName}]` : '')
const team = provisioningConfig.provisioningTeam
Expand All @@ -216,7 +216,7 @@ class AgentManager {
provisioningOK = true
} catch (err) {
warn(`Problem encountered during provisioning: ${err.toString()}`)
warn(`Reason: ${err.response?.body || 'unknown'}`)
warn(`Reason: ${err.response?.body || err.cause?.toString() || 'unknown'}`)
provisioningOK = false
}

Expand Down

0 comments on commit 68eb773

Please sign in to comment.