Merge pull request #1657 from mempool/nymkappa/bugfix/update-log
Add escaped slug into logs when slug does not match any pool
This commit is contained in:
commit
b4beb29f31
@ -7,6 +7,7 @@ import logger from '../logger';
|
|||||||
import blocks from './blocks';
|
import blocks from './blocks';
|
||||||
import { Common } from './common';
|
import { Common } from './common';
|
||||||
import loadingIndicators from './loading-indicators';
|
import loadingIndicators from './loading-indicators';
|
||||||
|
import { escape } from 'mysql2';
|
||||||
|
|
||||||
class Mining {
|
class Mining {
|
||||||
hashrateIndexingStarted = false;
|
hashrateIndexingStarted = false;
|
||||||
@ -110,7 +111,7 @@ class Mining {
|
|||||||
public async $getPoolStat(slug: string): Promise<object> {
|
public async $getPoolStat(slug: string): Promise<object> {
|
||||||
const pool = await PoolsRepository.$getPool(slug);
|
const pool = await PoolsRepository.$getPool(slug);
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
throw new Error(`This mining pool does not exist`);
|
throw new Error('This mining pool does not exist ' + escape(slug));
|
||||||
}
|
}
|
||||||
|
|
||||||
const blockCount: number = await BlocksRepository.$blockCount(pool.id);
|
const blockCount: number = await BlocksRepository.$blockCount(pool.id);
|
||||||
|
@ -5,6 +5,7 @@ import { Common } from '../api/common';
|
|||||||
import { prepareBlock } from '../utils/blocks-utils';
|
import { prepareBlock } from '../utils/blocks-utils';
|
||||||
import PoolsRepository from './PoolsRepository';
|
import PoolsRepository from './PoolsRepository';
|
||||||
import HashratesRepository from './HashratesRepository';
|
import HashratesRepository from './HashratesRepository';
|
||||||
|
import { escape } from 'mysql2';
|
||||||
|
|
||||||
class BlocksRepository {
|
class BlocksRepository {
|
||||||
/**
|
/**
|
||||||
@ -235,7 +236,7 @@ class BlocksRepository {
|
|||||||
public async $getBlocksByPool(slug: string, startHeight?: number): Promise<object[]> {
|
public async $getBlocksByPool(slug: string, startHeight?: number): Promise<object[]> {
|
||||||
const pool = await PoolsRepository.$getPool(slug);
|
const pool = await PoolsRepository.$getPool(slug);
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
throw new Error(`This mining pool does not exist`);
|
throw new Error('This mining pool does not exist ' + escape(slug));
|
||||||
}
|
}
|
||||||
|
|
||||||
const params: any[] = [];
|
const params: any[] = [];
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { escape } from 'mysql2';
|
||||||
import { Common } from '../api/common';
|
import { Common } from '../api/common';
|
||||||
import DB from '../database';
|
import DB from '../database';
|
||||||
import logger from '../logger';
|
import logger from '../logger';
|
||||||
@ -105,7 +106,7 @@ class HashratesRepository {
|
|||||||
public async $getPoolWeeklyHashrate(slug: string): Promise<any[]> {
|
public async $getPoolWeeklyHashrate(slug: string): Promise<any[]> {
|
||||||
const pool = await PoolsRepository.$getPool(slug);
|
const pool = await PoolsRepository.$getPool(slug);
|
||||||
if (!pool) {
|
if (!pool) {
|
||||||
throw new Error(`This mining pool does not exist`);
|
throw new Error('This mining pool does not exist ' + escape(slug));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find hashrate boundaries
|
// Find hashrate boundaries
|
||||||
|
@ -78,7 +78,6 @@ class PoolsRepository {
|
|||||||
const [rows]: any[] = await DB.query(query, [slug]);
|
const [rows]: any[] = await DB.query(query, [slug]);
|
||||||
|
|
||||||
if (rows.length < 1) {
|
if (rows.length < 1) {
|
||||||
logger.debug(`This slug does not match any known pool`);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user