Suppress some errors, Upload source maps to Sentry (#845)
This commit is contained in:
parent
b978b051d4
commit
6d42bc12bb
|
@ -16,6 +16,12 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "lts/*"
|
||||
cache: "npm"
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
- name: Sentry Release
|
||||
uses: getsentry/action-release@v1.2.0
|
||||
env:
|
||||
|
@ -25,3 +31,4 @@ jobs:
|
|||
with:
|
||||
environment: production
|
||||
ignore_empty: true
|
||||
sourcemaps: './build/assets'
|
||||
|
|
|
@ -6,10 +6,10 @@ import {
|
|||
useMemo,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { User } from 'pocketbase';
|
||||
import {
|
||||
client,
|
||||
formatError,
|
||||
User,
|
||||
} from '../pocketbase';
|
||||
import { buildRedirectUrl } from '../utils/url';
|
||||
import { Collections } from '../@types/pocketbase-types';
|
||||
|
|
|
@ -2,6 +2,7 @@ import * as Sentry from '@sentry/browser';
|
|||
import {
|
||||
client,
|
||||
formatError,
|
||||
ClientResponseError,
|
||||
} from '../pocketbase';
|
||||
import {
|
||||
IniFilesRecordFull,
|
||||
|
@ -49,6 +50,10 @@ const useDb = () => {
|
|||
|
||||
return Promise.resolve(tune.totalItems > 0 ? tune.items[0] as TunesRecordFull : null);
|
||||
} catch (error) {
|
||||
if ((error as ClientResponseError).isAbort) {
|
||||
return Promise.reject(new Error('Cancelled'));
|
||||
}
|
||||
|
||||
Sentry.captureException(error);
|
||||
databaseGenericError(new Error(formatError(error)));
|
||||
|
||||
|
@ -64,6 +69,10 @@ const useDb = () => {
|
|||
|
||||
return Promise.resolve(tune.totalItems > 0 ? tune.items[0] as IniFilesRecordFull : null);
|
||||
} catch (error) {
|
||||
if ((error as ClientResponseError).isAbort) {
|
||||
return Promise.reject(new Error('Cancelled'));
|
||||
}
|
||||
|
||||
Sentry.captureException(error);
|
||||
databaseGenericError(new Error(formatError(error)));
|
||||
|
||||
|
@ -90,6 +99,10 @@ const useDb = () => {
|
|||
totalItems: list.totalItems,
|
||||
});
|
||||
} catch (error) {
|
||||
if ((error as ClientResponseError).isAbort) {
|
||||
return Promise.reject(new Error('Cancelled'));
|
||||
}
|
||||
|
||||
Sentry.captureException(error);
|
||||
databaseGenericError(new Error(formatError(error)));
|
||||
|
||||
|
|
|
@ -57,26 +57,31 @@ const Hub = () => {
|
|||
|
||||
const loadData = debounce(async (searchText: string) => {
|
||||
setIsLoading(true);
|
||||
const { items, totalItems } = await searchTunes(searchText, page, pageSize);
|
||||
setTotal(totalItems);
|
||||
const mapped = items.map((tune) => ({
|
||||
...tune,
|
||||
key: tune.tuneId,
|
||||
year: tune.year,
|
||||
author: (tune['@expand'] as { userProfile: ProfilesRecord }).userProfile.username,
|
||||
displacement: `${tune.displacement}l`,
|
||||
aspiration: aspirationMapper[tune.aspiration],
|
||||
published: formatTime(tune.updated),
|
||||
stars: 0,
|
||||
}));
|
||||
setDataSource(mapped);
|
||||
setIsLoading(false);
|
||||
try {
|
||||
const { items, totalItems } = await searchTunes(searchText, page, pageSize);
|
||||
setTotal(totalItems);
|
||||
const mapped = items.map((tune) => ({
|
||||
...tune,
|
||||
key: tune.tuneId,
|
||||
year: tune.year,
|
||||
author: (tune['@expand'] as { userProfile: ProfilesRecord }).userProfile.username,
|
||||
displacement: `${tune.displacement}l`,
|
||||
aspiration: aspirationMapper[tune.aspiration],
|
||||
published: formatTime(tune.updated),
|
||||
stars: 0,
|
||||
}));
|
||||
setDataSource(mapped);
|
||||
} catch (error) {
|
||||
// request cancelled
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}, 300);
|
||||
|
||||
const debounceLoadData = useCallback((value: string) => {
|
||||
setSearchQuery(value);
|
||||
loadData(value);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const handleGlobalKeyboard = useCallback((e: KeyboardEvent) => {
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
import PocketBase from 'pocketbase';
|
||||
import PocketBase, {
|
||||
ClientResponseError,
|
||||
User,
|
||||
Record,
|
||||
} from 'pocketbase';
|
||||
import { fetchEnv } from './utils/env';
|
||||
|
||||
const API_URL = fetchEnv('VITE_POCKETBASE_API_URL');
|
||||
|
@ -28,4 +32,7 @@ export {
|
|||
formatError,
|
||||
formatTime,
|
||||
removeFilenameSuffix,
|
||||
ClientResponseError,
|
||||
User,
|
||||
Record,
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Record } from 'pocketbase';
|
||||
import { Record } from '../pocketbase';
|
||||
import {
|
||||
IniFilesRecord,
|
||||
ProfilesRecord,
|
||||
|
|
|
@ -5,7 +5,7 @@ import { visualizer } from 'rollup-plugin-visualizer';
|
|||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: 'build', // This changes the out put dir from dist to build
|
||||
outDir: 'build',
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
|
|
Loading…
Reference in New Issue