Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js.Promise .catchError() issue #7618

Closed
zabojad opened this issue Nov 15, 2018 · 6 comments
Closed

js.Promise .catchError() issue #7618

zabojad opened this issue Nov 15, 2018 · 6 comments
Labels
enhancement platform-javascript Everything related to JS / JavaScript

Comments

@zabojad
Copy link

zabojad commented Nov 15, 2018

Hi!
This code:

			// ...
			function(res : js.html.Response) {
				if (res.ok) {
					res.json()
					   .then(onSuccess)
					   .catchError(parseErrorStr.bind('PosApiPostResp',_));
			// ...

generates this with haxe 3.4.4

function(res) {
		if(res.ok) {
			res.json().then(onSuccess)["catch"](function(a2) {
				return parseErrorStr("PosApiPostResp",a2);
			});

I haven't seen any closed issue regarding this...

@markknol markknol added the platform-javascript Everything related to JS / JavaScript label Nov 15, 2018
@ncannasse
Copy link
Member

Does it still happens with haxe 4-0-preview 5 ?

@zabojad
Copy link
Author

zabojad commented Nov 16, 2018

@ncannasse not tested yet. I'll update the ticket if I find some time to do so.

@nadako
Copy link
Member

nadako commented Nov 26, 2018

What is the issue here exactly? The code looks fine to me.

@zabojad
Copy link
Author

zabojad commented Nov 26, 2018

@nadako it works indeed but the ["catch"]() looks a little bit ugly doesn't it? It could translate rather to .catch()...

@nadako
Copy link
Member

nadako commented Nov 26, 2018

Probably, I wonder if all the engines we support can parse keyword-fields, but I would assume so, given that Promise with it's catch is the part of the JS standard library nowadays.

Anyway that makes it a minor JS generator issue, I can look into it later!

@nadako
Copy link
Member

nadako commented Nov 26, 2018

I created a separate issue about that with a more appropriate title: #7645

@nadako nadako closed this as completed Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement platform-javascript Everything related to JS / JavaScript
Projects
None yet
Development

No branches or pull requests

4 participants