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

remoting HttpConnection exceptions #18

Open
filt3rek opened this issue Mar 9, 2021 · 0 comments
Open

remoting HttpConnection exceptions #18

filt3rek opened this issue Mar 9, 2021 · 0 comments

Comments

@filt3rek
Copy link

filt3rek commented Mar 9, 2021

Hej,

For those who still use haxe remoting, with Haxe 4, exceptions are not very pretty when sended back to the client.
So I have done a small modification in HttpConnection.hx like that :

public static function processRequest( requestData : String, ctx : Context ) : String {
		try {
			var u = new haxe.Unserializer(requestData);
			var path = u.unserialize();
			var args = u.unserialize();
			var data = ctx.call(path,args);
			var s = new haxe.Serializer();
			s.serialize(data);
			return "hxr" + s.toString();
		} catch( e ) {
			var s = new haxe.Serializer();
#if (haxe_ver >= 4)
			s.serializeException( e.message + "\r\n" + e.details() );
#else
			s.serializeException( e );
#end
			return "hxr" + s.toString();
		}
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant