Page MenuHomePhorge

PhutilErrorHandler: support multiple error listeners
ClosedPublic

Authored by avivey on Aug 11 2023, 19:03.

Details

Summary

Ref T15554. The plan is to add a new listener that will only listen to DEPRECATED events, and do something useful with them.

Test Plan

Test script in P26 shows registering 2 handlers and getting both invoked.

Diff Detail

Repository
rARC Arcanist
Branch
no-deprect-death
Lint
Lint Errors
SeverityLocationCodeMessage
Errorsrc/filesystem/PhutilErrorLog.php:31XHP20Tautological Expression
Unit
Tests Passed
Build Status
Buildable 949
Build 949: arc lint + arc unit

Event Timeline

avivey requested review of this revision.Aug 11 2023, 19:03
avivey planned changes to this revision.Aug 11 2023, 19:03

There are, in total, 3 call-sites to setErrorListener - in for the daemons, one for dark-console, and one (PhutilErrorLog) that lives in arcanist but is only used by the SSHD scripts.

Notably, that means the the listener function isn't used when running arc, and probably also in any of the scripts in phorge/bin/.

avivey planned changes to this revision.Aug 12 2023, 06:51
src/workflow/ArcanistLookWorkflow.php
57 ↗(On Diff #1242)

Probably this is a test in production

I like renaming the function!

We should probably have a timeline for removing the old function. Do we have a task for that?

src/filesystem/PhutilErrorLog.php
31

The linter did point out a legitimate concern here, however; this doesn't seem to be your code change. Should we file a new task?

This revision is now accepted and ready to land.Nov 26 2023, 06:57

I like renaming the function!

We should probably have a timeline for removing the old function. Do we have a task for that?

I feel like that kind of task will just fall down into oblivion....

src/filesystem/PhutilErrorLog.php
31

done - T15677

I like renaming the function!

We should probably have a timeline for removing the old function. Do we have a task for that?

I feel like that kind of task will just fall down into oblivion....

I agree, but that the alternative is leaving deprecated code around. I think we should probably come up with a formal deprecation plan, but that seems out of the scope here. I'll think on it and write up a task :)

This revision was landed with ongoing or failed builds.Nov 27 2023, 18:32
This revision was automatically updated to reflect the committed changes.

Sorry for the delayed review

src/error/PhutilErrorHandler.php
458

Is this something that should have try/catch around the invocation here? So one error handler doesn't impact the others from running?

src/error/PhutilErrorHandler.php
458

Yeah, good idea. I'll try to diff something.

avivey added inline comments.
src/error/PhutilErrorHandler.php
458

Filed T15690, because I'm not sure how to handle that right now...

src/error/PhutilErrorHandler.php
78

How many callers are there? Can we make updates so this can be removed? Or is this something commonly used via extensions?

src/error/PhutilErrorHandler.php
78

It's not common to call this, but there might be some extensions that use it to integrate with some error reporting. We can remove it whenever we feel like.