Skip to content

Commit

Permalink
Merge pull request #123 from dappnode/dev
Browse files Browse the repository at this point in the history
v0.1.15

Former-commit-id: 1786b6b
  • Loading branch information
eduadiez authored Oct 27, 2018
2 parents cf9f016 + 02e5728 commit 4cb694c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
18 changes: 9 additions & 9 deletions build/src/src/calls/fetchPackageData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const parse = require('utils/parse');
const logs = require('logs.js')(module);
const getManifest = require('modules/getManifest');
const getAvatar = require('modules/getAvatar');
const isSyncing = require('utils/isSyncing');
const isIpfsRequest = require('utils/isIpfsRequest');
// const isSyncing = require('utils/isSyncing');
// const isIpfsRequest = require('utils/isIpfsRequest');

/**
* Fetches the manifest of the latest version and its avatar.
Expand All @@ -25,13 +25,13 @@ const fetchPackageData = async ({
const packageReq = parse.packageReq(id);

// Make sure the chain is synced
if (!isIpfsRequest(packageReq) && await isSyncing()) {
return {
message: `Mainnet is still syncing`,
result: {},
logMessage: true,
};
}
// if (!isIpfsRequest(packageReq) && await isSyncing()) {
// return {
// message: `Mainnet is still syncing`,
// result: {},
// logMessage: true,
// };
// }


const manifest = await getManifest(packageReq);
Expand Down
13 changes: 11 additions & 2 deletions build/src/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,24 @@ const wrapErrors = (handler, event) =>
} catch (err) {
// Rename known shit-errors
// When attempting to call a contract while the chain is syncing:
if (err.message && err.message.includes('decode 0x from ABI')) {
if (err.message && (err.message.includes('decode 0x from ABI')
|| err.message.includes('decode address from ABI'))) {
err.code = 'SYNCING';
err.message = `Chain is still syncing: ${err.message}`;
}
// When attempting an JSON RPC but the connection with the node is closed:
if (err.message && err.message.includes('connection not open')) {
err.message = `Could not connect to ethchain: ${err.message}`;
}

logUserAction.log({level: 'error', event, ...error2obj(err), kwargs});
// ##### Don't reflect logId in the userActions logs (delete w/ immutable method)
const _kwargs = Object.assign({}, kwargs);
if (_kwargs && _kwargs.logId) delete _kwargs.logId;

// Don't log to userActions is "SYNCING" errors
if (err.code !== 'SYNCING') {
logUserAction.log({level: 'error', event, ...error2obj(err), kwargs: _kwargs});
}
logs.error('Call '+event+' error: '+err.message+'\nStack: '+err.stack);
return JSON.stringify({
success: false,
Expand Down

0 comments on commit 4cb694c

Please sign in to comment.