2018-02-22 14:26:19 -08:00
|
|
|
import { ApiResponseStatus } from 'wherehows-web/utils/api/shared';
|
2018-02-21 14:41:05 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a default msg for a given status
|
2018-02-22 14:26:19 -08:00
|
|
|
* @param {ApiResponseStatus} status
|
2018-02-21 14:41:05 -08:00
|
|
|
* @returns {string}
|
|
|
|
*/
|
2018-02-22 14:26:19 -08:00
|
|
|
const apiErrorStatusMessage = (status: ApiResponseStatus): string =>
|
2018-02-21 14:41:05 -08:00
|
|
|
(<{ [prop: number]: string }>{
|
2018-02-22 14:26:19 -08:00
|
|
|
[ApiResponseStatus.NotFound]: 'Could not find the requested resource',
|
|
|
|
[ApiResponseStatus.InternalServerError]: 'An error occurred with the server'
|
2018-02-21 14:41:05 -08:00
|
|
|
})[status];
|
|
|
|
|
|
|
|
export { apiErrorStatusMessage };
|