Skip to content

remoting HttpConnection exceptions #18

@filt3rek

Description

@filt3rek

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();
		}
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions