Skip to content

Commit

Permalink
Record errors, fix wrong invalid_amount error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Nov 12, 2023
1 parent 65c0447 commit bb62cf3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion app/components/cards/PostFull.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { repLog10, parsePayoutAmount } from 'app/utils/ParsersAndFormatters';
import extractContent from 'app/utils/ExtractContent';
import { immutableAccessor, objAccessor } from 'app/utils/Accessors';
import { isPostVisited, visitPost } from 'app/utils/helpers';
import { serverApiRecordEvent } from 'app/utils/ServerApiClient';
import Icon from 'app/components/elements/Icon';
import TimeVersions from 'app/components/elements/TimeVersions';
import Voting from 'app/components/elements/Voting';
Expand Down
15 changes: 11 additions & 4 deletions app/redux/TransactionSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,13 @@ function* broadcastOperation(
}
}
yield call(broadcastPayload, {payload})
let eventType = type.replace(/^([a-z])/, g => g.toUpperCase()).replace(/_([a-z])/g, g => g[1].toUpperCase());
if (eventType === 'Comment' && !op.parent_author) eventType = 'Post';
const page = eventType === 'Vote' ? `@${op.author}/${op.permlink}` : '';
serverApiRecordEvent(eventType, page);
} catch(error) {
console.error('TransactionSaga', error)
try {
serverApiRecordEvent('node_error/tx', JSON.stringify(operations) + ' ||| ' + error.toString())
} catch (err2) {
console.error('Cannot record tx error event:', err2)
}
if(errorCallback) errorCallback(error.toString())
}
}
Expand Down Expand Up @@ -297,6 +298,12 @@ function* broadcastPayload({payload: {operations, keys, username, hideErrors, su
console.error('TransactionSaga\tbroadcast', error)
// status: error

try {
serverApiRecordEvent('node_error/tx_broadcast', JSON.stringify(operations) + ' ||| ' + error.toString())
} catch (err2) {
console.error('Cannot record tx broadcast error event:', err2)
}

yield put(tr.actions.error({operations, error, hideErrors, errorCallback}))

for (const [type, operation] of operations) {
Expand Down
2 changes: 0 additions & 2 deletions app/redux/Transaction_Error.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ export default function transactionErrorReducer(
errorKey = errorStr = tt('chain_errors.only_vote_once_every');
} else if (errorKey.includes('Missing Active Authority')) {
errorKey = errorStr = tt('chain_errors.missing_active_authority');
} else if (errorKey.includes('')) {
errorKey = errorStr = tt('g.invalid_amount');
} else if (
errorKey.includes(
'Voting weight is too small, please accumulate more voting power or Golos Power'
Expand Down
1 change: 0 additions & 1 deletion server/api/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export default function useGeneralApi(app) {
const params = this.request.body;
const {csrf, type, value} = typeof(params) === 'string' ? JSON.parse(params) : params;
if (!checkCSRF(this, csrf)) return;
console.log('-- /record_event -->', this.session.uid, type, value);
const str_value = typeof value === 'string' ? value : JSON.stringify(value);
recordWebEvent(this, type, str_value);
this.body = JSON.stringify({status: 'ok'});
Expand Down
1 change: 1 addition & 0 deletions server/record_web_event.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export default function recordWebEvent(ctx, event_type, value) {
console.log('-- /record_event -->', event_type, value)
}

0 comments on commit bb62cf3

Please sign in to comment.