UNPKG

@prass/botpress-native

Version:

A simple and powerful SDK for integrating Botpress Chat API with React Native,

16 lines (13 loc) 532 B
import axios from 'axios'; import { Exception } from './exceptions.js'; const handleError = (error, context) => { var _a, _b; if (axios.isAxiosError(error)) { const errorMessage = ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || "Unknown error"; console.error(`Error in ${context}: ${errorMessage}`); throw new Exception(error); } throw error; }; export { handleError }; //# sourceMappingURL=errorHandler.js.map