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

Global error handler #22

Closed
RealyUniqueName opened this issue Aug 13, 2016 · 7 comments
Closed

Global error handler #22

RealyUniqueName opened this issue Aug 13, 2016 · 7 comments
Labels

Comments

@RealyUniqueName
Copy link
Owner

RealyUniqueName commented Aug 13, 2016

Implemented in e21a2e0

PHP provides an ability to globally handle errors, warnings and notices.
Need to implement access to this function from Haxe side.
http://php.net/manual/en/function.set-error-handler.php

@mockey
Copy link

mockey commented Aug 15, 2016

Well, the error_handler has a pretty complicated signature and I'm not sure what this errcontext really is and also it can return a string or an array but basically it would be something like this:

@:phpGlobal
extern ErrorHandling {
  static function set_error_handler(handler:Int->String->?String->?Int->?NativeArray->Bool, types:Int):String;
}

The problem is that you can't pass in a function directly here, I think only a closure would work. Maybe a Callable<T> abstract over Function would be a good idea, that converts static and instance functions to arrays? Do you handle function passing already in the generator?

@RealyUniqueName
Copy link
Owner Author

I don't see any problem here.
set_errror_handler can accept any closure. And closures should be generated correctly (not yet, but it's in the roadmap).

@mockey
Copy link

mockey commented Aug 15, 2016

Yeah, but you can't pass obj->func or Class::func directly, can you?

@RealyUniqueName
Copy link
Owner Author

I think those will be wrapped in anonymous functions :

var q = MyClass.method;
$q = function () {return MyClass::method()};

@mockey
Copy link

mockey commented Aug 15, 2016

I had this idea as well, but there was a problem, but I don't remember (of course).
What about obj->func?

@RealyUniqueName
Copy link
Owner Author

$q = function () use ($obj) { return $obj->func(); }

@RealyUniqueName
Copy link
Owner Author

Implemented in e21a2e0

RealyUniqueName pushed a commit that referenced this issue Jun 19, 2019
* Fix unix impl of sys_filetime

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

No branches or pull requests

2 participants