fleet/frontend/pages/SoftwarePage/components/AddSoftwareModal/helpers.ts
Roberto Dip 48ea95385e
final adjustments to return timeout errors for software (#19772)
for #19453


![image](https://github.com/fleetdm/fleet/assets/4419992/c9849cf4-ea78-4393-8693-8ff8ea612221)

I don't know how to test this in the server without a significant
refactor.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [ ] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-06-14 18:39:03 -03:00

13 lines
380 B
TypeScript

import { getErrorReason } from "interfaces/errors";
const UPLOAD_ERROR_MESSAGES = {
default: {
message: "Couldn't add. Please try again.",
},
};
// eslint-disable-next-line import/prefer-default-export
export const getErrorMessage = (err: unknown) => {
if (typeof err === "string") return err;
return getErrorReason(err) || UPLOAD_ERROR_MESSAGES.default.message;
};