mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复 shell 变量初始化检查,更新 sentry 版本
This commit is contained in:
@@ -133,6 +133,8 @@ export default ({ app }: { app: Application }) => {
|
||||
|
||||
app.use(errors());
|
||||
|
||||
Sentry.setupExpressErrorHandler(app);
|
||||
|
||||
app.use(
|
||||
(
|
||||
err: Error & { status: number },
|
||||
@@ -178,8 +180,6 @@ export default ({ app }: { app: Application }) => {
|
||||
res: Response,
|
||||
next: NextFunction,
|
||||
) => {
|
||||
Sentry.captureException(err);
|
||||
|
||||
res.status(err.status || 500);
|
||||
res.json({
|
||||
code: err.status || 500,
|
||||
|
||||
+22
-26
@@ -1,32 +1,28 @@
|
||||
import { Application } from 'express';
|
||||
import * as Sentry from '@sentry/node';
|
||||
import { nodeProfilingIntegration } from '@sentry/profiling-node';
|
||||
import Logger from './logger';
|
||||
import config from '../config';
|
||||
import fs from 'fs';
|
||||
import { parseVersion } from '../config/util';
|
||||
import config from '../config';
|
||||
import { parseContentVersion } from '../config/util';
|
||||
|
||||
export default async ({ expressApp }: { expressApp: Application }) => {
|
||||
const { version } = await parseVersion(config.versionFile);
|
||||
let version = '1.0.0';
|
||||
try {
|
||||
const content = fs.readFileSync(config.versionFile, 'utf-8');
|
||||
({ version } = parseContentVersion(content));
|
||||
} catch (error) {}
|
||||
|
||||
Sentry.init({
|
||||
ignoreErrors: [
|
||||
/SequelizeUniqueConstraintError/i,
|
||||
/Validation error/i,
|
||||
/UnauthorizedError/i,
|
||||
/celebrate request validation failed/i,
|
||||
],
|
||||
dsn: 'https://8b5c84cfef3e22541bc84de0ed00497b@o1098464.ingest.sentry.io/6122819',
|
||||
integrations: [
|
||||
new Sentry.Integrations.Http({ tracing: true }),
|
||||
new Sentry.Integrations.Express({ app: expressApp }),
|
||||
],
|
||||
tracesSampleRate: 0.8,
|
||||
release: version,
|
||||
});
|
||||
Sentry.init({
|
||||
ignoreErrors: [
|
||||
/SequelizeUniqueConstraintError/i,
|
||||
/Validation error/i,
|
||||
/UnauthorizedError/i,
|
||||
/celebrate request validation failed/i,
|
||||
],
|
||||
dsn: 'https://8b5c84cfef3e22541bc84de0ed00497b@o1098464.ingest.sentry.io/6122819',
|
||||
integrations: [nodeProfilingIntegration()],
|
||||
tracesSampleRate: 0.5,
|
||||
release: version,
|
||||
});
|
||||
|
||||
expressApp.use(Sentry.Handlers.requestHandler());
|
||||
expressApp.use(Sentry.Handlers.tracingHandler());
|
||||
|
||||
Logger.info('✌️ Sentry loaded');
|
||||
console.log('✌️ Sentry loaded');
|
||||
};
|
||||
Logger.info('✌️ Sentry loaded');
|
||||
console.log('✌️ Sentry loaded');
|
||||
|
||||
@@ -21,7 +21,6 @@ export default async ({ server }: { server: Server }) => {
|
||||
if (data) {
|
||||
const { token = '', tokens = {} } = safeJSONParse(data);
|
||||
if (headerToken === token || tokens[platform] === headerToken) {
|
||||
conn.write(JSON.stringify({ type: 'ping', message: 'hanhh' }));
|
||||
sockService.addClient(conn);
|
||||
|
||||
conn.on('data', (message) => {
|
||||
@@ -33,8 +32,6 @@ export default async ({ server }: { server: Server }) => {
|
||||
});
|
||||
|
||||
return;
|
||||
} else {
|
||||
conn.write(JSON.stringify({ type: 'ping', message: 'whyour' }));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user