mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-17 21:24:11 +00:00
Improve error handling in server (#812)
* add functions to convert all errors to `ErrorResponse` type
* replace all `{ message: error.toString() }` with `toErrorResponse(error)`
* refactor: all controllers to to use getErrorMessage and add types to the Response
* 404 for nonexistent api routes
This commit is contained in:
committed by
GitHub
parent
d432f1e3ff
commit
8a1474e8d6
@@ -2,7 +2,7 @@ import { ChangeEvent, useRef, useState } from 'react';
|
||||
import { Button, Input } from '@chakra-ui/react';
|
||||
import { IoCloudOutline } from '@react-icons/all-files/io5/IoCloudOutline';
|
||||
import { IoDownloadOutline } from '@react-icons/all-files/io5/IoDownloadOutline';
|
||||
import { ImportMap, unpackError } from 'ontime-utils';
|
||||
import { getErrorMessage, ImportMap } from 'ontime-utils';
|
||||
|
||||
import {
|
||||
getWorksheetNames as getWorksheetNamesExcel,
|
||||
@@ -59,7 +59,7 @@ export default function SourcesPanel() {
|
||||
setImportFlow('excel');
|
||||
setHasFile('done');
|
||||
} catch (error) {
|
||||
const errorMessage = unpackError(error);
|
||||
const errorMessage = getErrorMessage(error);
|
||||
setError(`Error uploading file: ${errorMessage}`);
|
||||
setWorksheets(null);
|
||||
setHasFile('none');
|
||||
|
||||
Reference in New Issue
Block a user