Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
fix(api): return error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Dec 11, 2020
1 parent d7f1d9b commit 253aa05
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deleteDevice/deleteDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const deleteDevice: AzureFunction = async (
log(context)({
error: error.message,
})
context.res = r(error, 500)
context.res = r({ error: error.message }, 500)
}
}

Expand Down
4 changes: 2 additions & 2 deletions geolocateCell/geolocateCell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ const geolocateCell: AzureFunction = async (
context.res = r(location.value)
log(context)({ location: location.value })
} else {
context.res = r(new Error(`Could not resolve cell ${c}`), 404)
context.res = r({ error: `Could not resolve cell ${c}` }, 404)
}
} catch (error) {
console.error({ error })
context.res = r(error, 500)
context.res = r({ error: error.message }, 500)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const geolocateCellFromUnwiredLabs: AzureFunction = async (
}
} catch (error) {
console.error({ error })
context.res = r(error, 500)
context.res = r({ error: error.message }, 500)
}
context.done()
}
Expand Down
2 changes: 1 addition & 1 deletion getDevice/getDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const getDevice: AzureFunction = async (
log(context)({
error: error.message,
})
context.res = r(error, 500)
context.res = r({ error: error.message }, 500)
}
}

Expand Down
2 changes: 1 addition & 1 deletion listDevices/listDevices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const listDevices: AzureFunction = async (
log(context)({
error: error.message,
})
context.res = r(error, 500)
context.res = r({ error: error.message }, 500)
}
}

Expand Down
2 changes: 1 addition & 1 deletion queryHistoricalDeviceData/queryHistoricalDeviceData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const queryHistoricalDeviceData: AzureFunction = async (
context.res = r(result)
} catch (error) {
console.error({ error })
context.res = r(error, 500)
context.res = r({ error: error.message }, 500)
}
}

Expand Down
2 changes: 1 addition & 1 deletion storeDeviceUpgrade/storeDeviceUpgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const storeDeviceUpgrade: AzureFunction = async (
log(context)({
error: error.message,
})
context.res = r(error, 500)
context.res = r({ error: error.message }, 500)
}
}

Expand Down
2 changes: 1 addition & 1 deletion updateDevice/updateDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const updateDevice: AzureFunction = async (
log(context)({
error: error.message,
})
context.res = r(error, 500)
context.res = r({ error: error.message }, 500)
}
}

Expand Down

0 comments on commit 253aa05

Please sign in to comment.