Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

response undefined when error occurs. #54

Closed
milkywayriver opened this issue Jan 19, 2018 · 6 comments
Closed

response undefined when error occurs. #54

milkywayriver opened this issue Jan 19, 2018 · 6 comments
Assignees
Labels

Comments

@milkywayriver
Copy link

	signedRequest(base+endpoint, opt, function(error, response) {
		if ( typeof response.msg !== 'undefined' && response.msg === 'Filter failure: MIN_NOTIONAL' ) {
			console.error('Order quantity too small. See exchangeInfo() for minimum amounts');
		}
		if ( callback ) callback(error, response);
		else console.log(side+'('+symbol+','+quantity+','+price+') ',response);
	}, 'POST');
};
@jaggedsoft
Copy link
Member

Thanks. Looking in to this

@milkywayriver
Copy link
Author

TypeError: Cannot read property 'msg' of undefined
/node_modules/node-binance-api/node-binance-api.js:143:25

/node_modules/node-binance-api/node-binance-api.js:143
if ( typeof response.msg !== 'undefined' && response.msg === 'Filter failure: MIN_NOTIONAL' ) {

@jaggedsoft
Copy link
Member

Perhaps something like this would work

		signedRequest(base+endpoint, opt, function(error, response) {
			if ( !response ) {
				if ( callback ) callback(error, response);
				else console.error('Order() error:', error);
				return;
			}
			if ( typeof response.msg !== 'undefined' && response.msg === 'Filter failure: MIN_NOTIONAL' ) {
				console.error('Order quantity too small. See exchangeInfo() for minimum amounts');
			}
			if ( callback ) callback(error, response);
			else console.log(side+'('+symbol+','+quantity+','+price+') ',response);
		}, 'POST');

@jaggedsoft jaggedsoft self-assigned this Jan 19, 2018
@jaggedsoft jaggedsoft added the bug label Jan 19, 2018
@milkywayriver
Copy link
Author

could be. please fix and i'll test.

@jaggedsoft
Copy link
Member

live in v0.4.3
jaggedsoft@b5bb192

@jaggedsoft
Copy link
Member

For anyone else reviewing this, it might be better to check if ( error ) instead, not sure the best way to handle this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants